tasos-py / Search-Engines-Scraper

Search google, bing, yahoo, and other search engines with python
MIT License
511 stars 137 forks source link

list proposal #28

Closed whitehat92 closed 2 years ago

whitehat92 commented 3 years ago

Would it be possible to add a list option, instead of a simple query? This could make it easier to automate some cases. Thank you

tasos-py commented 3 years ago

No, I don't think I'll add this option, I don't really see any benefits. But it would be trivial to just combine the rsults in a big list. Let me give you an example,

from search_engines import Google

queries = ['q1', 'q2']
results = [Google().search(q) for q in queries]
print([i for r in results for i in r.links()])

Does this do what you're looking for?

whitehat92 commented 3 years ago

Apparently yes, if the queries variable could read from the command line argument. Which script could I edit in order to add this snippet you suggested? It would have to be added to every search engine .py on engines folder, right? Thank you

tasos-py commented 3 years ago

Not necessarily, I think it can by done by adding a for loop here https://github.com/tasos-py/Search-Engines-Scraper/blob/master/search_engines_cli.py#L35, right after the else statement. Just split args.q by a separator and iterate over the items.