import requests
import zipfile
from io import BytesIO
from tempfile import TemporaryDirectory
import re

zip_url = 'http://www.pythonchallenge.com/pc/def/channel.zip'
r = requests.get(zip_url)

ids = []

def go(dir, id):
    ids.append(id)
    with open('{}/{}.txt'.format(dir, id)) as f:
        msg = f.read()
        next = re.search(r'Next nothing is (\d+)', msg)

        if next:
            return go(dir, next.group(1))



with TemporaryDirectory() as tmp_dir:
    with zipfile.ZipFile(BytesIO(r.content)) as package:
        package.extractall(tmp_dir)

        go(tmp_dir, 90052)
        
        for comment in ids:
            zip_info = package.getinfo('{}.txt'.format(comment))
            print(zip_info.comment.decode('utf-8'), end='')

c2e7ebea884d02a5697d185a229aa4cf879159c6
<mask token>


def go(dir, id):
    ids.append(id)
    with open('{}/{}.txt'.format(dir, id)) as f:
        msg = f.read()
        next = re.search('Next nothing is (\\d+)', msg)
        if next:
            return go(dir, next.group(1))


<mask token>

<mask token>


def go(dir, id):
    ids.append(id)
    with open('{}/{}.txt'.format(dir, id)) as f:
        msg = f.read()
        next = re.search('Next nothing is (\\d+)', msg)
        if next:
            return go(dir, next.group(1))


with TemporaryDirectory() as tmp_dir:
    with zipfile.ZipFile(BytesIO(r.content)) as package:
        package.extractall(tmp_dir)
        go(tmp_dir, 90052)
        for comment in ids:
            zip_info = package.getinfo('{}.txt'.format(comment))
            print(zip_info.comment.decode('utf-8'), end='')

<mask token>
zip_url = 'http://www.pythonchallenge.com/pc/def/channel.zip'
r = requests.get(zip_url)
ids = []


def go(dir, id):
    ids.append(id)
    with open('{}/{}.txt'.format(dir, id)) as f:
        msg = f.read()
        next = re.search('Next nothing is (\\d+)', msg)
        if next:
            return go(dir, next.group(1))


with TemporaryDirectory() as tmp_dir:
    with zipfile.ZipFile(BytesIO(r.content)) as package:
        package.extractall(tmp_dir)
        go(tmp_dir, 90052)
        for comment in ids:
            zip_info = package.getinfo('{}.txt'.format(comment))
            print(zip_info.comment.decode('utf-8'), end='')

import requests
import zipfile
from io import BytesIO
from tempfile import TemporaryDirectory
import re
zip_url = 'http://www.pythonchallenge.com/pc/def/channel.zip'
r = requests.get(zip_url)
ids = []


def go(dir, id):
    ids.append(id)
    with open('{}/{}.txt'.format(dir, id)) as f:
        msg = f.read()
        next = re.search('Next nothing is (\\d+)', msg)
        if next:
            return go(dir, next.group(1))


with TemporaryDirectory() as tmp_dir:
    with zipfile.ZipFile(BytesIO(r.content)) as package:
        package.extractall(tmp_dir)
        go(tmp_dir, 90052)
        for comment in ids:
            zip_info = package.getinfo('{}.txt'.format(comment))
            print(zip_info.comment.decode('utf-8'), end='')

import requests
import zipfile
from io import BytesIO
from tempfile import TemporaryDirectory
import re

zip_url = 'http://www.pythonchallenge.com/pc/def/channel.zip'
r = requests.get(zip_url)

ids = []

def go(dir, id):
    ids.append(id)
    with open('{}/{}.txt'.format(dir, id)) as f:
        msg = f.read()
        next = re.search(r'Next nothing is (\d+)', msg)

        if next:
            return go(dir, next.group(1))



with TemporaryDirectory() as tmp_dir:
    with zipfile.ZipFile(BytesIO(r.content)) as package:
        package.extractall(tmp_dir)

        go(tmp_dir, 90052)
        
        for comment in ids:
            zip_info = package.getinfo('{}.txt'.format(comment))
            print(zip_info.comment.decode('utf-8'), end='')
