Created
May 31, 2021 21:49
-
-
Save MindPatch/afcbcefccbc62762ad1daebe23448437 to your computer and use it in GitHub Desktop.
Startpage.com parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Author
MindPatch
commented
May 31, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment