\d+?)'
15 | # monitors i(index), p(primary), n1(name), n2(name)
16 | MPAT = re.compile(
17 | r'\s*(?P\d+?):\s*(\+){0,1}(?P\*){0,1}(?P\w+)\s*' + WHwhXY + r'\s*(?P\w+)$')
18 |
19 |
20 | class Monitors(object):
21 | '''
22 | List monitor's infor.
23 | '''
24 |
25 | def __init__(self, xrandr=None):
26 | self.xrandr = xrandr or "xrandr"
27 | self.cmd = shlex.split(self.xrandr + " --listmonitors")
28 | self.info = self.parse(self.output)
29 |
30 | def update(self):
31 | self.info = self.parse(self.output)
32 |
33 | @property
34 | def output(self):
35 | return subprocess.check_output(self.cmd).decode("utf-8")
36 |
37 | def parse(self, output):
38 | '''
39 | output like this:
40 | Monitors: 2
41 | 0: +*eDP1 1366/310x768/170+0+0 eDP1
42 | 1: +HDMI1 3840/1220x2160/690+1366+0 HDMI1
43 | '''
44 | res = {}
45 | outputs = output.split('\n')
46 | m = re.match(NPAT, outputs[0])
47 | if m:
48 | N = int(m.groupdict()['N'])
49 | res['N'] = N
50 | else:
51 | N = 0
52 | res['highW>1920'] = []
53 | res['lowDPI<96'] = []
54 | for line in outputs[1:N+1]:
55 | m = re.match(MPAT, line)
56 | if m:
57 | gd = m.groupdict()
58 | NAME = 'm' + gd['i']
59 | if gd['p']:
60 | res['primary'] = NAME
61 | W = int(gd['W'])
62 | if W > 1920:
63 | res['highW>1920'].append((NAME, round(W/1920, 2)))
64 | H = int(gd['H'])
65 | w = int(gd['w'])
66 | h = int(gd['h'])
67 | dpix = round(W/(w/10/2.54), 2)
68 | dpiy = round(H/(h/10/2.54), 2)
69 | DPI = round((W**2+H**2)**0.5/((w**2+h**2)**0.5/10/2.54), 2)
70 | if DPI < 96:
71 | res['lowDPI<96'].append((NAME, round(96/DPI, 2)))
72 | res[NAME] = dict(
73 | index=int(gd['i']),
74 | name1=gd['n1'],
75 | name2=gd['n2'],
76 | W=W, H=H,
77 | w=w, h=h,
78 | X=int(gd['X']),
79 | Y=int(gd['Y']),
80 | dpix=dpix, dpiy=dpiy, DPI=DPI,
81 | )
82 | return res
83 |
84 |
85 | # TODO: https://blog.summercat.com/configuring-mixed-dpi-monitors-with-xrandr.html
86 | if __name__ == '__main__':
87 | import pprint
88 | M = Monitors()
89 | pprint.pprint(M.parse(M.output))
90 |
--------------------------------------------------------------------------------
/you-get/iqiyi.md:
--------------------------------------------------------------------------------
1 | 1 None tvid
2 | ===========
3 |
4 | error:
5 | ```shell
6 | File "/usr/lib/python3.10/site-packages/you_get/extractors/iqiyi.py", line 139, in prepare
7 | info_u = 'http://pcw-api.iqiyi.com/video/video/playervideoinfo?tvid=' + tvid
8 | TypeError: can only concatenate str (not "NoneType") to str
9 | ```
10 |
11 | debug:
12 | ```python
13 | from you_get.common import r1, get_html, matchall
14 |
15 | html = get_html('https://www.iqiyi.com/v_19rrnojxs8.html')
16 | # "tvid":355406500 "vid":"f7b856423aa11ffb68590d516d028074"
17 | matchall(html,[r'(.{10}355406500.{10})'])
18 | matchall(html,[r'(.{10}f7b856423aa11ffb68590d516d028074.{10})'])
19 | ```
20 |
21 | fix:
22 | ```python
23 | tvid = r1(r'#curid=(.+)_', self.url) or \
24 | r1(r'tvid=([^&]+)', self.url) or \
25 | r1(r'data-player-tvid="([^"]+)"', html) or r1(r'tv(?:i|I)d=(.+?)\&', html) or r1(r'param\[\'tvid\'\]\s*=\s*"(.+?)"', html) or \
26 | r1(r'"tvid"\s*:\s*(\d+?),', html)
27 | videoid = r1(r'#curid=.+_(.*)$', self.url) or \
28 | r1(r'vid=([^&]+)', self.url) or \
29 | r1(r'data-player-videoid="([^"]+)"', html) or r1(r'vid=(.+?)\&', html) or r1(r'param\[\'vid\'\]\s*=\s*"(.+?)"', html) or \
30 | r1(r'"vid"\s*:\s*"(.+?)",', html) or r1(r'vid="(.+?)";', html)
31 | ```
32 |
33 |
34 | 2 cookie headers, HTTP Error 400: Bad Request
35 | =============================================
36 |
37 | error:
38 | ```
39 | you-get -c ~/.mozilla/firefox/xxx/cookies.sqlite https://www.iqiyi.com/v_t93ogo9gbc.html --debug
40 |
41 | [DEBUG] get_content: http://pcw-api.iqiyi.com/video/video/playervideoinfo?tvid=3091246365554100
42 | [DEBUG] HTTP Error with code400
43 | ...........
44 | File "/usr/lib/python3.10/site-packages/you_get/extractors/iqiyi.py", line 142, in prepare
45 | json_res = get_content(info_u)
46 | File "/usr/lib/python3.10/site-packages/you_get/common.py", line 474, in get_content
47 | response = urlopen_with_retry(req)
48 | ..........
49 | File "/usr/lib/python3.10/urllib/request.py", line 643, in http_error_default
50 | raise HTTPError(req.full_url, code, msg, hdrs, fp)
51 | urllib.error.HTTPError: HTTP Error 400: Bad Request
52 | ```
53 |
54 | debug:
55 | ```
56 | for cookie in list(cookies):
57 | cookie_strings.append(cookie.name + '=' + cookie.value)
58 | cookie_headers = {'Cookie': '; '.join(cookie_strings)}
59 | req.headers.update(cookie_headers)
60 | ```
61 |
62 | fix:
63 | ```
64 | TODO
65 | ```
66 |
--------------------------------------------------------------------------------
/儿童动画/make-list.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding: utf-8 -*-
3 |
4 | # Copyright (c) 2020 shmilee
5 |
6 | import urllib.parse
7 |
8 | video_dir = (
9 | #'巴巴爸爸.Barbapapa'
10 | #'巴塔木流行儿歌'
11 | #'巴塔木童谣'
12 | #'巴塔木ABC'
13 | #'超级宝贝JOJO'
14 | '海底小纵队'
15 | #'小猪佩奇'
16 | )
17 | vlc_list = 'shmilee.m3u8'
18 |
19 |
20 | def decode(s):
21 | return urllib.parse.unquote(s, encoding='utf-8', errors='replace')
22 |
23 | with open('./%s/%s' % (video_dir, vlc_list), 'r') as fin:
24 | new_lines = [
25 | s if s.startswith('#EXT') else '%s/%s' % (video_dir, decode(s))
26 | for s in fin.readlines()
27 | ]
28 | with open('./%s.m3u8' % video_dir,'w') as out:
29 | for l in new_lines:
30 | out.write(l)
31 |
--------------------------------------------------------------------------------
/儿童动画/小猪佩奇.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/小猪佩奇.tar.gz
--------------------------------------------------------------------------------
/儿童动画/巴塔木ABC.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/巴塔木ABC.tar.gz
--------------------------------------------------------------------------------
/儿童动画/巴塔木流行儿歌.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/巴塔木流行儿歌.tar.gz
--------------------------------------------------------------------------------
/儿童动画/巴塔木童谣.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/巴塔木童谣.tar.gz
--------------------------------------------------------------------------------
/儿童动画/汪汪队立大功/src/2021:
--------------------------------------------------------------------------------
1 | https://www.olevod.com/index.php/vod/play/id/31566/sid/1/nid/1.html
2 |
3 | URL='https://europe.olemovienews.com/hlstimeofffmp4/20211117/ekiGwgui/mp4/ekiGwgui.mp4/index-v1-a1.m3u8'
4 |
5 |
6 | mpv $URL
7 |
8 | [ffmpeg] https: HTTP error 502 Cannot find server.
9 | [ffmpeg/demuxer] hls: Failed to open an initialization section in playlist 0
10 |
11 | [ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: could not find corresponding trex (id 1)
12 | [ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: could not find corresponding track id 0
13 | [ffmpeg/demuxer] mov,mp4,m4a,3gp,3g2,mj2: trun track id unknown, no tfhd was found
14 |
15 | ffmpeg -i $URL out.mp4
16 |
17 | [https @ 0x55920b3ab6c0] HTTP error 502 Cannot find server.
18 | [hls @ 0x55920afe1940] Failed to open an initialization section in playlist 0
19 |
20 |
21 | FIX:
22 |
23 | m3u8 EXT-X-MAP ffmpeg
24 |
25 | ffmpeg Range header download m3u8 seekable
26 |
27 | """
28 | mpv --demuxer-lavf-o-append=http_seekable=0 $URL
29 | ffmpeg -http_seekable 0 -i $URL out.mp4
30 | """
31 |
--------------------------------------------------------------------------------
/儿童动画/海底小纵队/21799:
--------------------------------------------------------------------------------
1 | https://vip1.lz-cdn1.com/20230814/21799_1dcc557b/2000k/hls/mixed.m3u8
2 |
--------------------------------------------------------------------------------
/儿童动画/海底小纵队/2211:
--------------------------------------------------------------------------------
1 | https://vip.lz-cdn10.com/20220812/2211_e34412e7/1200k/hls/index.m3u8
2 |
--------------------------------------------------------------------------------
/儿童动画/海底小纵队/5416:
--------------------------------------------------------------------------------
1 | https://vip.lz-cdn1.com/20220512/5416_5bc7d68a/1200k/hls/index.m3u8
2 | https://vip1.lz-cdn1.com/20220512/5416_5bc7d68a/1200k/hls/mixed.m3u8
3 |
--------------------------------------------------------------------------------
/儿童动画/海底小纵队/src/read_1_6.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | src=${1:-"第1季.html.gz"}
4 | season=${src%.*}
5 | cmd="you-get %s -O 海底小纵队-${season}-%s" # rm .mp4?
6 |
7 | n=1
8 | zcat $src | sed -n "/href=.*html/p" | while read line; do
9 | url=$(echo $line | sed "s|.*href=\"\(https://.*.html\)\".*title=.*|\1|g")
10 | if [[ x$url == x ]]; then
11 | echo "-----------> $line No url <----------"
12 | continue
13 | fi
14 | echo "==> 第$n集 url: $url"
15 | title=$(echo $line | sed "s|.*\" title=\"\(.*\)\" dt-eid=.*|\1|g")
16 | if [[ x$title == x ]]; then
17 | title="第$n集"
18 | echo "-----------> 第$n集 title: 出错 <----------"
19 | else
20 | if [[ $n -ge 10 ]]; then
21 | sn=$n
22 | else
23 | sn="0$n"
24 | fi
25 | # 5-6-特别
26 | if echo $title | grep "第$sn话" >/dev/null; then
27 | title=$(echo $title | sed -e "s/第$sn话//" -e 's/^[ ]*//')
28 | elif echo $title | grep "海底小纵队特别篇" >/dev/null; then
29 | title=$(echo $title | sed -e "s/海底小纵队特别篇$n://")
30 | fi
31 | if [[ x$title == x"海底小纵队第五季" ]]; then
32 | title="第$n集"
33 | else
34 | title="第$n集-$title"
35 | fi
36 | echo "==> 第$n集 title: $title"
37 | fi
38 | n=$((n+1))
39 | torun="$(printf "$cmd\n" "$url" "$title")"
40 | echo $torun
41 | $torun
42 | #break
43 | done
44 |
--------------------------------------------------------------------------------
/儿童动画/海底小纵队/src/特别篇.html.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/特别篇.html.gz
--------------------------------------------------------------------------------
/儿童动画/海底小纵队/src/第1季.html.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/第1季.html.gz
--------------------------------------------------------------------------------
/儿童动画/海底小纵队/src/第2季.html.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/第2季.html.gz
--------------------------------------------------------------------------------
/儿童动画/海底小纵队/src/第3季.html.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/第3季.html.gz
--------------------------------------------------------------------------------
/儿童动画/海底小纵队/src/第4季.html.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/第4季.html.gz
--------------------------------------------------------------------------------
/儿童动画/海底小纵队/src/第5季.html.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/第5季.html.gz
--------------------------------------------------------------------------------
/儿童动画/海底小纵队/src/第6季.html.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/海底小纵队/src/第6季.html.gz
--------------------------------------------------------------------------------
/儿童动画/超级宝贝JOJO.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/超级宝贝JOJO.tar.gz
--------------------------------------------------------------------------------
/儿童动画/迷你小洞/read_1_3.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | src=${1:-"迷你小洞-第一季.gz"}
4 | season=${src%.*}
5 | cmd="you-get %s -O ${season}-%s.mp4"
6 | ##m3u8="${season}.m3u8"
7 | ##echo "#EXTM3U" > $m3u8
8 | youmpvlist="${season}.txt"
9 | echo -n > $youmpvlist
10 |
11 | n=1
12 | zcat $src | sed 's||\n|g' | sed -n "/href=.*html/p" | while read line; do
13 | url=$(echo $line | sed "s|.*href=\"\(//.*.html\)\".*title=.*|\1|g")
14 | if [[ x$url == x ]]; then
15 | echo "-----------> $line No url <----------"
16 | continue
17 | fi
18 | url="https:$url"
19 | echo "==> 第$n集 url: $url"
20 | title=$(echo $line | sed "s|.*\" title=\"\(.*\)\" class=\"album.*|\1|g")
21 | if [[ x$title == x ]]; then
22 | title="第$n集"
23 | echo "-----------> 第$n集 title: 出错 <----------"
24 | fi
25 | ##echo "#EXTINF:$n, $title" >> $m3u8
26 | ##echo "$url" >> $m3u8
27 | echo "$url" >> $youmpvlist
28 | n=$((n+1))
29 | torun="$(printf "$cmd\n" "$url" "$title")"
30 | echo $torun
31 | #$torun
32 | #break
33 | done
34 |
--------------------------------------------------------------------------------
/儿童动画/迷你小洞/you-mpv.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright (C) 2023 shmilee
3 |
4 | cat $1 | while read url; do
5 | echo $url
6 | you-get -p mpv $url
7 | done
8 |
--------------------------------------------------------------------------------
/儿童动画/迷你小洞/迷你小洞-玩创造.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/迷你小洞/迷你小洞-玩创造.gz
--------------------------------------------------------------------------------
/儿童动画/迷你小洞/迷你小洞-第一季.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/迷你小洞/迷你小洞-第一季.gz
--------------------------------------------------------------------------------
/儿童动画/迷你小洞/迷你小洞-第三季.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/迷你小洞/迷你小洞-第三季.gz
--------------------------------------------------------------------------------
/儿童动画/迷你小洞/迷你小洞-第二季.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shmilee/scripts/f4c5510625008867f8861d4fab5e63efb65b2fb4/儿童动画/迷你小洞/迷你小洞-第二季.gz
--------------------------------------------------------------------------------