Python? Beautiful Soup?? ? ????? ? ??: MIDI ?? ?
???? ??? ????? ?? API? ??? ????? ???? ???? ????? ?? ??? ? ????. Python? Beautiful Soup ?????? ? ????? ?? ???? ????? ?? ??? ? ?? ??? ???? ?????.
MIDI ???? ????? ??? Nintendo ??? ??? ???? ?? Magenta ???? ?????? ?? ?? ???????. VGM(??? ?? ?? ????)?? MIDI ??? ??? ?????.
?? ??
Python 3 ? pip? ???? ??? ?????. ???? ???? ?? ?? ??? ???? ????? ?? ?????.
pip install requests==2.22.0 beautifulsoup4==4.8.1
????? 4? ???? ????(????? 3? ? ?? ???? ????).
??? ???? ??? ??? ???? ? ?? ??
?? HTML? ??? BeautifulSoup ??? ??? ?????.
import requests from bs4 import BeautifulSoup vgm_url = 'https://www.vgmusic.com/music/console/nintendo/nes/' html_text = requests.get(vgm_url).text soup = BeautifulSoup(html_text, 'html.parser')
soup
??? ???? HTML? ??? ? ????. soup.title
? ??? ??? ?????. print(soup.get_text())
?? ???? ?????.
???? ??? ?? ??????
find()
? find_all()
???? ??????. soup.find()
? ?? ??? ??????(?: soup.find(id='banner_ad').text
? ?? ?? ???? ???). soup.find_all()
?? ??? ?????. ?? ?? ??? ?? ????? URL? ?????.
for link in soup.find_all('a'): print(link.get('href'))
find_all()
? ??? ???? ?? ?? ????? ?? ??? ?? ??? ?????. ?? ??? Beautiful Soup ??? ?????.
HTML ?? ? ?? ??
?? ??? ???? ?? ?????? ???? HTML? ?????. ? ????? ?????. ??? ???? ???? ??? ??? ??? ????.
??? ??? ?? ? ???? ??? ??? MIDI ??? ?????? ????. ???? ??? ??(??? ??? ?? ??, "??")? ????? ???? ???? HTML ??? ???? ? ??? ???.
???? ?? find_all()
? ???? MIDI ??? ??? ??? ???? ?????(??? ??? ?? ?? ??).
??? nes_midi_scraper.py
:
import re import requests from bs4 import BeautifulSoup vgm_url = 'https://www.vgmusic.com/music/console/nintendo/nes/' html_text = requests.get(vgm_url).text soup = BeautifulSoup(html_text, 'html.parser') if __name__ == '__main__': attrs = {'href': re.compile(r'\.mid$')} tracks = soup.find_all('a', attrs=attrs, string=re.compile(r'^((?!\().)*$')) count = 0 for track in tracks: print(track) count += 1 print(len(tracks))
MIDI ??? ????? ?? ??? ???? ? ??? ?????. python nes_midi_scraper.py
?? ?????.
MIDI ?? ????
?? ???? MIDI ??? ????? ?????. download_track
? nes_midi_scraper.py
??? ?????:
pip install requests==2.22.0 beautifulsoup4==4.8.1
? ??? ? ??? ?????? ??? ?? ???? ?????. ??? ?? ?????? ????? ??????. ? 2230?? MIDI ??? ?????? ???(????? ?? ???? ?? ??).
?? ??? ??
? ????? ?? ??? ?????? ?? ? ????. ???? ???? ?? ??? ??? ? ??? ?? ?????. ????? ?? ??? ?????. Mido(MIDI ??? ???) ? Magenta(??? ???)? ?? ?????? ???? ? ??? ?????.
? ??? Beautiful Soup? ???? Python?? ? ???? ? HTML ?? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

???? Python ?? ?? ?????? ?? ????, "??? ?????, ?? ??"? ???? ??? ??? ??? ?? ??? ?????. 1. ???? ?? ? ??? ?? ?????. ?? ???? ?? ??? ???? ??? ? ? ????. ?? ??, Spoke () ?? ???? ??? ??? ?? ??? ?? ????? ?? ??? ??? ????. 2. ???? ?? ???? ??? ??? ?????? Draw () ???? ???? ????? ?? ???? ?? ??? ???? ??? ???? ?? ?? ?? ??? ????? ?? ?? ????? ?? ?????. 3. Python ?? ???? ???????. ?? ???? ??? ???? ?? ???? ??? ????? ??? ?? ???? ??? ???? ????. ??? ??? ??? ???? ? ??? "?? ??"??????. 4. ???? ? ???? ?? ??? ?????

?? ??? ??? ?? ? ? ?? ?? ??? ??? ?? ? ? ?? ?? ?????. 1. ?? ?? ??? ???? ??????, ??? ??? ???? ??? ?????. 2. ??? ?? ??? ?? ?? ???? ???? ??? ???? ???? ???? ? ????. 3. ?? ?? ?? ?? ?? ??? ??? ?? ?? ? ? ????? ?? ??? ????? ??????. 4. Args? *Kwargs? ???? ?? ?? ??? ?? ? ? ????? ???? ????? ?? ?????? ????? ???? ???? ?????? ???????.

???? __iter __ () ? __next __ () ???? ???? ?????. ???? ??? ? ??? ????, ?? ???? ?? ??? ??? ???? ?????. 1. ???? ?? () ?? ? ??? ??? ???? ? ?? ??? ?? ? ?? ???? ??? ????. 2. ???? ?? ??? ???? ??? ???? ???? ???? ???? ?? ???? ?????. 3. ???? ???? ?? ??? ?? ? ? ? ??? ?? ? ???????? ? ? ??? ?? ??? ??? ???? ?? ? ? ???? ??????. ?? : ??? ?? ???? ??? ???? ????. ???? ?? ?? ? ??? ?????? ???? ? ?? ?? ? ? ????.

??? ???? @ClassMethod ?????? ?? ????? ?? ? ??????. ? ?? ?? ??? ??? ?? (CLS)?? ??? ??? ?????? ???? ? ?????. ?? ????? ?? ?? ???? ??? ??? ??? ?? ????? ?? ?? ? ? ????. ?? ??, ?? ????? show_count () ???? ?? ? ?? ?? ?????. ??? ???? ?? ? ?? @ClassMethod ?????? ???? ??? ??? ???? ?? Change_var (new_value) ???? ?? ? ?? ?? ?? CLS? ???????. ??? ???? ???? ?? (?? ?? ??) ? ?? ??? (?? ?? ?? ??)? ??? ?? ??, ?? ??? ? ??? ?? ??? ?????. ???? ??? ??? ????.

API ??? ??? ??? ?? ??? ???? ???? ???? ????. 1. Apikey? ?? ??? ?? ????, ????? ?? ?? ?? URL ?? ??? ?????. 2. Basicauth? ?? ???? ??? Base64 ??? ??? ??? ??? ????? ?????. 3. OAUTH2? ?? Client_ID ? Client_Secret? ?? ??? ?? ?? ?? ??? BearEtroken? ???????. 4. ?? ??? ???? ?? ?? ?? ???? ????? ???? ?? ?? ? ????. ???, ??? ?? ??? ??? ???? ?? ??? ???? ???? ?? ?????.

Python? MagicMethods (?? Dunder ??)? ??? ??? ???? ? ???? ??? ????, ?? ??? ???? ????. 1. ??? ??, ??, ??? ?? ?? ?? ?? ??? ?? ? ? ????. 2. ???? ?? ??? ?? ??? ? ?? (__init__, __repr_, __str__), ?? ?? (__add__, __sub__, __mul__) ? ?? ?? (__eq__, ___LT__); 3. ??? ??? ? ??? ??? ??? ????? ??????. ?? ??, __repr__? ???? ??? ??? ??? ?????? ?? ???? ??? ????? ???????. 4. ???? ????? ????? ??? ??????.

pythonmanagesmemoryautomicallicallicallicallicallicallicallicallicallysingandagarbagecollector.referenceCountingTrackshowmanyvariablestrefertoanobject, whenthecountreacheszero, thememoryisfreed. ??? itcannothandlecircular -references, wheretwoobjectsferotherbuta

@property? ???? ?? ??? ??? ???? ???? ??????, ??? ??? ? ? ??? ?? ?? ?? ??? ?????. 1. @property ?????? ?? getter ???? ???? ??? ??? ????? ?? ?? ??? ?????. 2. ?? ?? ???? ?? .Setter? ???? ?? ??? ?? ? ? ????. .setter? ???? ??? ?? ?? ?????. 3. ?? ?? ??, ?? ?? ?? ?? ?? ? ?? ?? ?? ??? ??? ?? ??? ?????. 4.?? ??? ? ?? ??? ?? ??? ??? ?? ?? ?? ??? ??? ??? ??? ?????. 5. ???? ? ???? ??? ????? ???? ?? ???? ???? full_name ??? ?????.
