Skip to content

Instantly share code, notes, and snippets.

@kilianplapp
Created November 29, 2022 20:21
Show Gist options
  • Save kilianplapp/a4a6c38ad7e2c578b52157d1923bce2e to your computer and use it in GitHub Desktop.
Save kilianplapp/a4a6c38ad7e2c578b52157d1923bce2e to your computer and use it in GitHub Desktop.
Scrape 50 most recent pastes on PasteBin.com
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