Skip to content

Instantly share code, notes, and snippets.

@nick3499
Created March 20, 2023 22:13
Show Gist options
  • Save nick3499/f576b0e5a3ae19a32c2daa106f5f8eb0 to your computer and use it in GitHub Desktop.
Save nick3499/f576b0e5a3ae19a32c2daa106f5f8eb0 to your computer and use it in GitHub Desktop.
Web scraper which scrapes embed/ link; requests.get; BeautifulSoup; subprocess.run
#!/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)
@nick3499
Copy link
Author

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 to get the markup, a BeautifulSoup instance to scrape the specific link followed by subprocess.run which opens that link in Chromium browser.

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