Skip to content

Instantly share code, notes, and snippets.

@ythosa
Last active April 30, 2020 13:46
Show Gist options
  • Select an option

  • Save ythosa/7fd8feb782dc959ab69a52cd371ef9b0 to your computer and use it in GitHub Desktop.

Select an option

Save ythosa/7fd8feb782dc959ab69a52cd371ef9b0 to your computer and use it in GitHub Desktop.

Revisions

  1. ythosa renamed this gist Apr 30, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. ythosa revised this gist Apr 30, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Parser template
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@ import subprocess
    def parsing(site_link):
    curl_command = f'curl {site_link} > data.json'

    data = subprocess.run(cmd_command, shell=True)
    data = subprocess.run(curl_command, shell=True)

    if data.returncode != 0:
    exit('It was some evil there :( Try again :(')
  3. ythosa revised this gist Apr 30, 2020. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions Parser template
    Original file line number Diff line number Diff line change
    @@ -2,10 +2,7 @@
    import json
    import subprocess

    def parsing(playlist_link):
    _, user_id, playlist_id = playlist_link.split('_')
    user_id = user_id[8:]

    def parsing(site_link):
    curl_command = f'curl {site_link} > data.json'

    data = subprocess.run(cmd_command, shell=True)
    @@ -14,4 +11,6 @@ def parsing(playlist_link):
    exit('It was some evil there :( Try again :(')

    with open('data.json', 'r', encoding='cp1251') as f:
    data = json.load(f)
    data = json.load(f)

    return data
  4. ythosa created this gist Apr 30, 2020.
    17 changes: 17 additions & 0 deletions Parser template
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    # Ez pz parser
    import json
    import subprocess

    def parsing(playlist_link):
    _, user_id, playlist_id = playlist_link.split('_')
    user_id = user_id[8:]

    curl_command = f'curl {site_link} > data.json'

    data = subprocess.run(cmd_command, shell=True)

    if data.returncode != 0:
    exit('It was some evil there :( Try again :(')

    with open('data.json', 'r', encoding='cp1251') as f:
    data = json.load(f)