Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Link zum Kanal: https://rumble.com/c/SC360Media
- # Das Programm sucht auf der Seite nach dem lezten Video
- import re
- import subprocess
- from urllib.request import Request, urlopen, urljoin
- # Externe Abhängigkeit
- from bs4 import BeautifulSoup
- def get_latest():
- def _latest(a):
- return int(re.search(r"\-(\d+)", a["href"]).group(1))
- base_url = "https://rumble.com"
- headers = {
- "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:126.0) Gecko/20100101 Firefox/126.0"
- }
- doc = BeautifulSoup(
- urlopen(
- Request(
- urljoin(base_url, "c/SC360Media"),
- headers=headers,
- )
- ).read(),
- "html.parser",
- )
- videos = [
- a
- for a in doc.find_all("a", attrs={"class": "videostream__link link"}, href=True)
- if "gehts-los-folge" in a["href"]
- ]
- return urljoin(base_url, max(videos, key=_latest)["href"])
- print(get_latest())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement