DeaD_EyE icon

gehtslos.py

DeaD_EyE | PRO | 07/11/24 07:24:23 PM UTC | 0 ⭐ | 574 👁️ | Never ⏰ | []
Python |

970 B

|

None

|

0 👍

/

0 👎

# 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())
 

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎