Compare commits

...

1 Commits

Author SHA1 Message Date
fluffy 297a766aca youtube result 2021-04-27 19:05:24 -07:00
3 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,7 @@
import mastodon import mastodon
import random import random
import requests
import re
def randline(fname): def randline(fname):
with open(fname) as afile: with open(fname) as afile:
@ -22,6 +24,12 @@ def bot():
access_token='token.secret', access_token='token.secret',
api_base_url='https://botsin.space') api_base_url='https://botsin.space')
query = requests.get(f'https://www.youtube.com/results?search_query={beats}')
match = re.search(r'\?v=([^"]+)"', query.text)
if match:
beats += f'\n\nhttps://youtube.com/watch?v={match.group(1)}'
print(beats)
mdon.status_post(beats) mdon.status_post(beats)
if __name__ == '__main__': if __name__ == '__main__':

2
poetry.lock generated
View File

@ -140,7 +140,7 @@ python-versions = "*"
[metadata] [metadata]
lock-version = "1.1" lock-version = "1.1"
python-versions = "^3.8" python-versions = "^3.8"
content-hash = "33cd2b69284ee759688156fe7c8d9ffe2c87151c5b090ba6f8d892a4b22a629a" content-hash = "8ee8ca988e50681b2b43c03d064ff31812170d326f87a71b23e13d6ed0bb86e4"
[metadata.files] [metadata.files]
blurhash = [ blurhash = [

View File

@ -8,6 +8,7 @@ authors = ["fluffy <fluffy@beesbuzz.biz>"]
python = "^3.8" python = "^3.8"
"Mastodon.py" = "^1.5.1" "Mastodon.py" = "^1.5.1"
wordfilter = "^0.2.6" wordfilter = "^0.2.6"
requests = "^2.25.1"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]