mirror of
https://github.com/vale981/kindle_fetch
synced 2025-03-04 16:41:38 -05:00
fix breakage due to amazon change
This commit is contained in:
parent
800a291ed6
commit
8a1c30198f
1 changed files with 12 additions and 13 deletions
|
@ -1,19 +1,18 @@
|
||||||
#! /usr/bin/env python
|
#! /usr/bin/env python
|
||||||
from pathlib import Path
|
import argparse
|
||||||
|
import asyncio
|
||||||
|
import logging
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import urllib.request
|
|
||||||
import asyncio
|
|
||||||
import argparse
|
|
||||||
import logging
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from aioimaplib import aioimaplib
|
import urllib.request
|
||||||
from collections import namedtuple
|
|
||||||
import re
|
|
||||||
from asyncio import wait_for
|
from asyncio import wait_for
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from email.parser import BytesHeaderParser, BytesParser
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from email.parser import BytesHeaderParser, BytesParser
|
||||||
|
from pathlib import Path
|
||||||
|
import quopri
|
||||||
|
from aioimaplib import aioimaplib
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -60,11 +59,11 @@ def get_download_link(text):
|
||||||
Get the download link and whether the file is the full document or
|
Get the download link and whether the file is the full document or
|
||||||
just `page` pages from the email body.
|
just `page` pages from the email body.
|
||||||
"""
|
"""
|
||||||
m = re.search(
|
|
||||||
r"\[Download PDF\]\((.*?)\)",
|
|
||||||
text.replace("\n", " ").replace("\r", "").replace(" ", " "),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
text = quopri.decodestring(text).decode("utf-8", errors="ignore")
|
||||||
|
logger.debug(text)
|
||||||
|
|
||||||
|
m = re.search(r'''href="(https://.*\.amazon\..*?)"''', text)
|
||||||
if not m:
|
if not m:
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue