Created
November 29, 2022 20:21
-
-
Save kilianplapp/a4a6c38ad7e2c578b52157d1923bce2e to your computer and use it in GitHub Desktop.
Scrape 50 most recent pastes on PasteBin.com
This file contains 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 | |
from lxml import html | |
def getPastes(): | |
for link in html.fromstring(requests.get("https://pastebin.com/archive").text).xpath('//tr//a'): | |
if str(link.get('href')).startswith('/archive/'): continue | |
yield (str(link.get('href')).replace('/', '')) | |
for i in getPastes(): | |
print(i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment