Forum Academy Marketplace Showcase Pricing Features

Search for and get data from other websites?

Hey, I’d like to set up an that allows me to search news sites based on a) title b) body c) date that it was published and display this data on my app.

Any idea on how I’d do this?

If I had the data in my own database, it would be obvious how to display it. I’m trying to figure out how to get into the database. Or perhaps, I don’t need to get it into my own database first?

Anyone have any thoughts and/or other resources I could read?

Try the Plugin Import.io see if it helps…

You could start with searching for news APIs. Here’s one: https://newsapi.org/

You wouldn’t necessarily need to save anything to your database, you just call the API and display the response. You’d use the API Connector plugin to do this. Some APIs require that you create an account with them to get an API key for access. Some are free, some are paid, some limit your quote depending on your access level. Lots to explore!


Gaby | Coaching Bubble

Thanks! I found this one that you mentioned: https://newsapi.org/ and also: https://webhose.io/

I’ll start to work and see if I can hack something together. I’ve only been playing around with bubble for ~10 hours, but am feeling more confident then I should to build something :wink:

Sweet! Welcome! If you need any help with those, just reach out :slight_smile:

@romanmg holy #$%#$% I figured out way more then I thought I would! Definitely gives me confidence for the future.

So, I have it pulling the titles from CNN and I can switch the source with radio button. I don’t know how I figured this out, but it works!!

Right now, the list is sorted randomly, but I want to sort it by when it was published.

Here’s the screen shot of the current logic.

Any ideas?

Sweet! You’re close with the setup. Set your repeating group type and source to “News API - Articles from a source’s articles” and then add the :sorted modifer on the source to sort by the field you want (I’d bet there’s one for publication date), and set descending = yes. Then in the cell, the text should just be current cell’s title.

What you have currently is you’re pulling the entire list into each cell and displaying a random item, which makes it seem like the RG is a single list - it’s actually a list of lists the way you have it set up. Adjust with what I described above, and then the RG will be a list of individual articles. The RG will also be sorted by the field of your choice by structuring it this way

Boom, we did it. Yay! Thanks for the help.

Ahh interesting. Basically, you need to do the sorting from the database (or from the database through the API first) first and then the individual cell is only displaying details about individual records. Is that basically right?

Next question. Now, I want to filter these titles from the input I have in an input field.

Here’s what the current “code” looks like.

I tried to add :contains Inputkeyword #1’s value (see image) but this caused the result to now be yes or no. I understand the logic with returning yes and no, because I’m just asking if it the title has a specific word in it not.

I need to show the entire title, given it has a specific keyword. Any thoughts?

Think of the repeating group as a whole as the thing that’s retrieving a list of articles. So to change the list you display, you’ll need to filter and sort at the repeating group source. E.g. If I only want a list of articles by a specific author, I filter the source by author.

Yes, the cells display the info for each article in that list, but if you’re only wanting specific titles, that means you want specific articles, which means you need to filter your source.

Try adding :filtered at the RG source … “title contains input keyword#1’s value”

Ah okay. I get the logic (a little more) just need to see if I can get it work. Thanks!

1 Like

Looks like I have the basic thing working well!

Wow, this was 1,000,000 the most complex thing I’ve ever done on a computer in my life. In less then 2 hours!

2 Likes

Awesome!! You took on an API in your first day of Bubbling. You’re going to do great things :wink:

Well, it wasn’t my first, first day, but the first time I actually tried to build something that I wanted.

I have to go to bed now, but I’ll work on this tomorrow. I still need to filter by dates, and do a few other things. Maybe create an account for voting.

The goal is to import many news sources, so people can input keywords and instantly see how a number of new sources are covering the story and then find what they want.

Okay, two more quick questions. I just pushed the app live (in under 4 hours!) https://comparenews.bubbleapps.io/

  1. It seems like there’s a limited number of news stories coming through. My RG is 20 cells, but it always shows fewer stories than this. Any idea why?

  2. I’d like to make the headline clickable too. I know how to get the URL from each post, but how do I make it a hyperlink?

Nice, good job!!

  1. See if there’s a default for how many items are returned… I’ve seen that with APIs a lot where they only send back a few and you have to add an optional parameter to specifically define the number of items returned. Sometimes there’s also a limit.

  2. Two ways to do this depending on whether you want to open the link in a new tab or not. If you want to open in a new tab, swap out the text element for a link element (it should be pretty obvious from there). Otherwise, create a workflow when the text is clicked > navigate to external page > dynamic URL will be “Current cell’s [url]” - note that this will open in the same page.

Use a link instead of a text field and set the URL… If you choose to keep the text field, Run a Workflow on the test field > Navigation > External URL.

I think that should do it

Cheers!

@KION2 @romanmg Thanks for the help on the link. I should have remembered how to do this, but I was pretty late last night :wink:

Re: the API. I did some research. Some people say that the NewsAPI has a default return 10 and has a max of 50. However, when researching the NewsAPI documentation, it doesn’t say that I can increase to 50 stories. So, I’m not sure I can do anything.

In the case that I could do this, how would I send this parameter? All of the information in the RG data source is based on what should be returned to me. I’m guessing of “number of articles” was something you could change, that option would be available in the RG data source?

In this case, this would be a parameter you’d set up in the API connector. Add a body parameter: results = 100 or something like that. Sometimes parameters are sent in the URL too. Either way, if you made the parameter public, it would be available to you when you use it in the RG if you wanted to change that number dynamically.

Ok thanks. I’ll check this out. Actually, I’m thinking about changing the design so only 10 articles per source might work anyway. But it would be useful to research how to use the APIs.

This is so much fun!

Thanks for your help, you’re awesome. I feel like bubble should being pay you to be in the forum :wink:

1 Like