-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.py
40 lines (28 loc) · 864 Bytes
/
script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 18 23:54:35 2023
@author: amir
"""
import requests
import re
import sys
counter = 0
url = input(str("ENTER URL :"))
session = requests.session()
session.headers.update({'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/64.0.3282.167 Chrome/64.0.3282.167 Safari/537.36'})
html_page = session.get(url)
# pattern = r"""((http|https)+\:\/\/[a-zA-Z0-9\/\.\-\_\!\@\#\$\%\^\&\*\(\)]+\.mp3)"""
pattern = r"""([https+\:\/\/[a-zA-Z0-9\/\.\-\_\!\@\#\$\%\^\&\*\(\)]+\.mp3)"""
music = set()
string = html_page.text
regex = re.findall(pattern,string)
if len(regex) !=0:
for link in regex :
music.add(link)
else:
print( "LINK NOT FOUND !")
sys.exit()
for link in music:
print(f'\n{counter} : {link}')
counter +=1