Created
March 20, 2023 22:13
-
-
Save nick3499/f576b0e5a3ae19a32c2daa106f5f8eb0 to your computer and use it in GitHub Desktop.
Web scraper which scrapes embed/ link; requests.get; BeautifulSoup; subprocess.run
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
#!/bin/python3 | |
'''Scrape embed link from white hat Web page.''' | |
from requests import get | |
from subprocess import run | |
from bs4 import BeautifulSoup | |
# color codes | |
orng = '\x1b[33m' | |
rset = '\x1b[0m' | |
inp = input('Enter bitchute link: ') # input Bitchute link string | |
res = get(inp) # response | |
soup = BeautifulSoup(res.text, 'html.parser') # BeautifulSoup instance | |
embed_link = soup.iframe['data-lazy-src'] # scrape Bitchute embed link | |
print(f'{orng}{soup.title.text}{rset}') # print title | |
# open chromium browser then browse Bitchute embed link | |
run(['/usr/lib/chromium/chromium', '--show-component-extension-options', | |
'--enable-gpu-rasterization', '--no-default-browser-check', '--disable-pings', | |
'--media-router=0', '--enable-remote-extensions', '--load-extension', | |
'--user-data-dir=/tmp/tmp.GW42CgJVjw', '--flag-switches-begin', | |
'--flag-switches-end', embed_link], check=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this morning, I wrote a small scraper that simply scrapes the embed/ link from a particular Web page of a particular Web site and then opens it in Chromium browser. I used
requests
toget
the markup, a BeautifulSoup instance to scrape the specific link followed bysubprocess.run
which opens that link in Chromium browser.