Skip to content

Instantly share code, notes, and snippets.

@MindPatch
Created May 31, 2021 21:49
Show Gist options
  • Save MindPatch/afcbcefccbc62762ad1daebe23448437 to your computer and use it in GitHub Desktop.
Save MindPatch/afcbcefccbc62762ad1daebe23448437 to your computer and use it in GitHub Desktop.
Startpage.com parser
import requests
import sys
import threading
from queue import Queue
from bs4 import BeautifulSoup
def test(c):
req = requests.get(f'https://www.startpage.com/do/search?q={sys.argv[1]}&segment=startpage.brave&page={c}',headers={"User-agent":'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36'}).content.decode()
soup = BeautifulSoup(req, "html.parser")
ancher = soup.find_all('a', {'class': "w-gl__result-url result-link"})
for i in ancher:
print(i['href'])
for i in range(1,11):
test(i)
@MindPatch
Copy link
Author

$ python3 startpage.py "Hello World"
https://en.wikipedia.org/wiki/%22Hello,_World!%22_program
https://en.wikipedia.org/wiki/Hello_World_(film)
https://www.youtube.com/watch?v=Yw6u6YkTgQ4
https://www.hello-world.com/
https://www.learnpython.org/en/Hello,_World!
https://www.programiz.com/c-programming/examples/print-sentence
https://www.programiz.com/cpp-programming/examples/print-sentence
https://blog.hackerrank.com/the-history-of-hello-world/
https://www.helloworldstudio.org/
https://gobyexample.com/hello-world
https://www.manning.com/books/hello-world-second-edition
https://guides.github.com/activities/hello-world/
....etc ....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment