├── .gitignore
├── 20200111HatePolitics.txt
├── 2020OpenTicket.py
├── 20字注音文.py
├── Demo
├── README.MD
├── fifth_floor_bot.py
├── first_push_bot.py
├── magician_terminator.py
└── time_post.py
├── FindFunc.py
├── Give
└── Checker.py
├── IP_Analyzer.py
├── Joke_BooHow.py
├── LICENSE
├── Ptt25signBot
├── Dockerfile
├── Ptt25signBot.py
├── Ptt25signBot.spec
├── README.MD
├── docker-compose.yml
└── ptt_info.json
├── PttApp
├── BoardInfo.py
├── BoardList.json
├── crawl.json
└── crawler.py
├── README.md
├── SearchInBoard.py
├── Start.bat
├── Util.py
├── check_aid.py
├── clone_searcher
└── clone_searcher.py
├── first_post
├── README.MD
└── first_post.py
├── multi_post
├── MultiPO.py
├── MultiPO.spec
├── MultiPO_RealTime.py
└── README.MD
├── multi_thread_crawler
├── README.MD
└── crawler.py
├── requirements.txt
└── wait_register.py
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | *.egg-info/
24 | .installed.cfg
25 | *.egg
26 | MANIFEST
27 |
28 | # PyInstaller
29 | # Usually these files are written by a python script from a template
30 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
31 | *.manifest
32 |
33 | # Installer logs
34 | pip-log.txt
35 | pip-delete-this-directory.txt
36 |
37 | # Unit test / coverage reports
38 | htmlcov/
39 | .tox/
40 | .coverage
41 | .coverage.*
42 | .cache
43 | nosetests.xml
44 | coverage.xml
45 | *.cover
46 | .hypothesis/
47 | .pytest_cache/
48 |
49 | # Translations
50 | *.mo
51 | *.pot
52 |
53 | # Django stuff:
54 | *.log
55 | local_settings.py
56 | db.sqlite3
57 |
58 | # Flask stuff:
59 | instance/
60 | .webassets-cache
61 |
62 | # Scrapy stuff:
63 | .scrapy
64 |
65 | # Sphinx documentation
66 | docs/_build/
67 |
68 | # PyBuilder
69 | target/
70 |
71 | # Jupyter Notebook
72 | .ipynb_checkpoints
73 |
74 | # pyenv
75 | .python-version
76 |
77 | # celery beat schedule file
78 | celerybeat-schedule
79 |
80 | # SageMath parsed files
81 | *.sage.py
82 |
83 | # Environments
84 | .env
85 | .venv
86 | env/
87 | venv/
88 | ENV/
89 | env.bak/
90 | venv.bak/
91 |
92 | # Spyder project settings
93 | .spyderproject
94 | .spyproject
95 |
96 | # Rope project settings
97 | .ropeproject
98 |
99 | # mkdocs documentation
100 | /site
101 |
102 | # mypy
103 | .mypy_cache/
104 | /Account.txt
105 | /Account2.txt
106 | /Account3.txt
107 | HatePoliticsList*.txt
108 | /PttApp/Account.txt
109 | .idea/
110 | PTTLibrary/
111 | /multi_thread_crawler/account_list.txt
--------------------------------------------------------------------------------
/20200111HatePolitics.txt:
--------------------------------------------------------------------------------
1 | 此內容由抓超貼程式產生
2 | 共耗時 20 秒執行完畢
3 |
4 | 此程式是由 CodingMan 透過 PTT Library 開發,
5 |
6 | 蒐集範圍為 ALLPOST 搜尋 (HatePolitics) 情況下編號 6090 ~ 9052
7 | 共 2963 篇文章
8 |
9 | 1/11 winterson □ [討論] 時力 民眾黨得票率能超…(HatePolitics)
10 | 1/11 winterson □ [討論] 蟑螂是不是現在開始放… (HatePolitics)
11 | 1/11 winterson □ [黑特] 10點以後就是年輕人的… (HatePolitics)
12 | 1/11 winterson □ [討論] 世代對立超越省籍了嗎? (HatePolitics)
13 | 1/11 winterson □ [討論] 蔡正元是臥底嗎? (HatePolitics)
14 | 1/11 winterson R: [討論] 百年難得一件的政治奇才 (HatePolitics)
15 | 1/11 winterson □ [討論] 說好的蓋牌民調呢? (HatePolitics)
16 | 1/11 winterson □ [討論] 紅色小藍 (HatePolitics)
17 | 1/11 winterson □ [討論] 如果柯文哲加入時代力量 (HatePolitics)
18 | 1/11 winterson R: [討論] 有多少柯粉最後是投蔡的?(HatePolitics)
19 | 1/11 winterson R: [討論] 楊瓊瓔vs洪慈庸vs張睿倉 (HatePolitics)
20 | 1/11 winterson □ [轉錄] 不亂講話拿的到150萬票嗎(HatePolitics)
21 | 1/11 winterson R: [黑特] 民進黨61 國民黨38 民… (HatePolitics)
22 |
23 | 1/11 kero2377 □ [討論] 大家有割包皮嗎? (HatePolitics)
24 | 1/11 kero2377 □ [討論] 高爾萱是不是真的很紅 (HatePolitics)
25 | 1/11 kero2377 □ [Live] 2020大選直播與置底討… (HatePolitics)
26 | 1/11 kero2377 □ [討論] 投完了 (HatePolitics)
27 | 1/11 kero2377 □ [討論] 吳亦凡的6 好聽嗎 (HatePolitics)
28 | 1/11 kero2377 □ [討論] 贏了,開心不起來。 (HatePolitics)
29 | 1/11 kero2377 □ [討論] 賴局長加油。 (HatePolitics)
30 | 1/11 kero2377 R: [創作] kero2020總統立委個人… (HatePolitics)
31 |
32 | 1/11 kusomanfcu □ [討論] 明天早上電影 (HatePolitics)
33 | 1/11 kusomanfcu □ [討論] 我說你們在哪兒排隊排… (HatePolitics)
34 | 1/11 kusomanfcu □ [討論] 要不要猜測 (HatePolitics)
35 | 1/11 kusomanfcu □ [討論] kero請進 (HatePolitics)
36 | 1/11 kusomanfcu □ [討論] 話說開盤開始 (HatePolitics)
37 | 1/11 kusomanfcu □ [討論] 韓粉快崩潰吧 (HatePolitics)
38 | 1/11 kusomanfcu □ [創作] TMD (HatePolitics)
39 | 1/11 kusomanfcu □ [討論] 柯p沒說錯啊 (HatePolitics)
40 |
41 | 1/11 songgood □ [討論] 博麗靈夢供在神桌上沒… (HatePolitics)
42 | 1/11 songgood □ [討論] 6年後見是什麼情況 (HatePolitics)
43 | 1/11 songgood □ [討論] 大家摳打不要用完 留個…(HatePolitics)
44 | 1/11 songgood □ [討論]很迪的士尼很滑的鼠很白…(HatePolitics)
45 | 1/11 songgood □ [討論] 芙蘭達 分成三份 你會… (HatePolitics)
46 | 1/11 songgood □ [討論] 政黨票也開太慢了吧 (HatePolitics)
47 | 1/11 songgood □ [討論] 顏家現在心裡會很幹韓… (HatePolitics)
48 | 1/11 songgood □ [討論] 時力為何要扯台派立委… (HatePolitics)
49 |
50 | 1/11 Lakeotter □ [討論] 誰落選,最有可能發生… (HatePolitics)
51 | 1/11 Lakeotter □ [討論] 自己的國家未來,自己… (HatePolitics)
52 | 1/11 Lakeotter □ [討論] 大選得票率,大家來預… (HatePolitics)
53 | 1/11 Lakeotter □ [討論] 誰輸了,其支持者最有…(HatePolitics)
54 | 1/11 Lakeotter □ [黑特] ● 開心,看了一年的鬧…(HatePolitics)
55 | 1/11 Lakeotter □ [黑特] 狂賀!韓國瑜落選! (HatePolitics)
56 | 1/11 Lakeotter □ [黑特] 草包再繼續唬爛嘛 (HatePolitics)
57 |
58 | 1/11 gogoto990 □ [討論] 我被八卦桶180天怎辦? (HatePolitics)
59 | 1/11 gogoto990 □ [討論] 蘿兒到底值不值得練啊? (HatePolitics)
60 | 1/11 gogoto990 □ [討論] 不要穿真理褲投票好嗎? (HatePolitics)
61 | 1/11 gogoto990 □ [新聞] 獨/吳敦義預計八點宣… (HatePolitics)
62 | 1/11 gogoto990 □ [討論] 高虹安傻眼了 (HatePolitics)
63 | 1/11 gogoto990 □ [討論] 李問 (HatePolitics)
64 |
65 | 1/11 BleedWang R: [新聞] 看診遇韓粉給嗜睡藥 衛…(HatePolitics)
66 | 1/11 BleedWang □ [討論] 阿味家族要滅了 (HatePolitics)
67 | 1/11 BleedWang □ [討論] 高鈺婷加油!!! (HatePolitics)
68 | 1/11 BleedWang □ [討論] 沈智慧滾了 (HatePolitics)
69 | 1/11 BleedWang □ [討論] 可笑的宅卡拉 (HatePolitics)
70 | 1/11 BleedWang R: [討論] 今晚是不是前時代力量… (HatePolitics)
71 | 1/11 BleedWang R: [黑特] 高雄藍立委會不會氣死 (HatePolitics)
72 | 1/11 BleedWang R: [討論] 侯友誼會跳船嗎 (HatePolitics)
73 | 1/11 BleedWang □ [討論] 挺韓網紅的現狀 (HatePolitics)
74 | 1/11 BleedWang □ [討論] 民進黨2022台中市長初選 (HatePolitics)
75 | 1/11 BleedWang R: [討論] 台中市超級深藍區,沈… (HatePolitics)
76 | 1/11 BleedWang R: [討論] 關鍵時刻怎麼開始吹韓… (HatePolitics)
77 | 1/11 BleedWang R: [討論] 如果英找國昌入閣,大… (HatePolitics)
78 | 1/11 BleedWang R: [討論] 台中江立委是不是很有… (HatePolitics)
79 | 1/11 BleedWang R: [討論] 高雄人會心軟嗎 (HatePolitics)
80 |
81 | 1/11 pp771017 □ [討論] 三國群英傳online該養… (HatePolitics)
82 | 1/11 pp771017 □ [討論] 因為印泥沾染而判無效… (HatePolitics)
83 | 1/11 pp771017 □ [討論] 在台南茶魔買綠茶點什… (HatePolitics)
84 | 1/11 pp771017 □ [討論] 貓跟狗選舉的話誰會贏 (HatePolitics)
85 | 1/11 pp771017 □ [討論] 這次最讓你傻眼的黑馬 (HatePolitics)
86 | 1/11 pp771017 □ [討論] 新北蔡依林之後要幹嘛? (HatePolitics)
87 | 1/11 pp771017 □ [討論] 韓是史上最弱母雞嗎? (HatePolitics)
88 | 1/11 pp771017 R: [討論] 蔡英文有沒有機會突破7…(HatePolitics)
89 | 1/11 pp771017 □ [討論] 韓國瑜罷免案在今天過… (HatePolitics)
90 | 1/11 pp771017 □ [討論] 如果明天重演2018台北… (HatePolitics)
91 |
92 | 1/11 alberchi □ [討論] 跨年要去市政府嗎? (HatePolitics)
93 | 1/11 alberchi □ [討論] 怎麼加入swag? (HatePolitics)
94 | 1/11 alberchi □ [討論] 結果出來了! (HatePolitics)
95 | 1/11 alberchi □ [討論] 韓國輸慘了!爽 (HatePolitics)
96 | 1/11 alberchi □ [討論] 投票結果出來了! (HatePolitics)
97 | 1/11 alberchi □ [黑特] 爽啦!烙跑仔吃噴啦 (HatePolitics)
98 | 1/11 alberchi □ [討論] 明天還有韓粉空拍造勢… (HatePolitics)
99 | 1/11 alberchi □ [討論] 好多開始洗風向的呦 (HatePolitics)
100 |
101 | 1/11 omanorboyo □ [討論] 為啥花京院帥沒三秒就… (HatePolitics)
102 | 1/11 omanorboyo □ [討論] 只等那信號一響 殺殺 (HatePolitics)
103 | 1/11 omanorboyo □ [討論] 韓確定掰了 GG私米達 … (HatePolitics)
104 | 1/11 omanorboyo □ [討論] 柯志恩是同情票太多嗎@@?(HatePolitics)
105 | 1/11 omanorboyo □ [黑特] 親民黨給我乖乖下去啦 操(HatePolitics)
106 | 1/11 omanorboyo □ [討論] 淡水蔡依林如果沒蠢到… (HatePolitics)
107 | 1/11 omanorboyo □ [討論] "目前"不分區名單 (HatePolitics)
108 |
109 | 1/11 singking □ [討論] 所以我說那些垃圾抹黑… (HatePolitics)
110 | 1/11 singking □ [討論] 高雄十大路名哪一條最… (HatePolitics)
111 | 1/11 singking □ [討論] 柯韓糞會哭暈在廁所嗎???(HatePolitics)
112 | 1/11 singking R: [討論] 民進黨貶韓策略大成功… (HatePolitics)
113 | 1/11 singking □ [討論] 我大膽預言 含粉再次偽…(HatePolitics)
114 | 1/11 singking R: [討論] 阿伯該道歉了吧 (HatePolitics)
115 |
116 | 1/11 serenitymice □ [討論] 江楓當初選憐星才是正… (HatePolitics)
117 | 1/11 serenitymice □ [討論] 牛舌餅要吃厚的還是薄… (HatePolitics)
118 | 1/11 serenitymice □ [黑特] 上帝公會覺得被基督教… (HatePolitics)
119 | 1/11 serenitymice □ [討論] 農曆新年的鹿港算好玩… (HatePolitics)
120 | 1/11 serenitymice □ [討論] 大家排隊之餘,來吸點… (HatePolitics)
121 | 1/11 serenitymice □ [討論] 我英要衝破800萬了 (HatePolitics)
122 |
123 | 1/11 fantasy14 □ [討論] 今天要選幾號啊? (HatePolitics)
124 | 1/11 fantasy14 □ [討論] 要怎麼去消滅蟑螂呀? (HatePolitics)
125 | 1/11 fantasy14 □ [討論] 大家一天都吃幾餐? (HatePolitics)
126 | 1/11 fantasy14 □ [討論] 年輕人菸不要抽太多 (HatePolitics)
127 | 1/11 fantasy14 □ [討論] 2016年算是有通過智力… (HatePolitics)
128 | 1/11 fantasy14 □ [討論] 韓粉們的身心科預約好… (HatePolitics)
129 | 1/11 fantasy14 □ [討論] 舔韓議員 不支持韓選黨…(HatePolitics)
130 | 1/11 fantasy14 □ [討論] 小菸票數破800萬了 (HatePolitics)
131 | 1/11 fantasy14 R: [黑特] 女翻譯太爛了吧 (HatePolitics)
132 |
133 | 1/11 zxc445567 □ [討論]下週開盤要買進哪檔股票?(HatePolitics)
134 | 1/11 zxc445567 □ [討論] 肥宅明天要宅在家還是? (HatePolitics)
135 | 1/11 zxc445567 □ [討論] 中天開始檢討知識藍 經…(HatePolitics)
136 | 1/11 zxc445567 □ [討論] 以後是不是可以正大光… (HatePolitics)
137 | 1/11 zxc445567 □ [討論] 挺韓五唬將之後會號召… (HatePolitics)
138 | 1/11 zxc445567 □ [討論] 來民調一下 民眾黨是那…(HatePolitics)
139 | 1/11 zxc445567 R: [討論] 郭台銘真的很不懂政治 (HatePolitics)
140 |
141 | 1/11 kymco9999 □ [討論] 1124東奧正名可以解讀… (HatePolitics)
142 | 1/11 kymco9999 □ [討論] 下午四點後會有媒體公… (HatePolitics)
143 | 1/11 kymco9999 □ [黑特] 韓國瑜支持者轉華視 (HatePolitics)
144 | 1/11 kymco9999 □ [黑特] 屏東怎麼了阿 (HatePolitics)
145 | 1/11 kymco9999 □ [討論] 投票率? (HatePolitics)
146 | 1/11 kymco9999 □ [討論] 證明長輩還是很多賭爛… (HatePolitics)
147 | 1/11 kymco9999 □ [討論] 2024民眾黨柯文哲會出… (HatePolitics)
148 |
149 | 1/11 wwwaa1217 □ [討論] 芭芒柳和波蜜大家推薦… (HatePolitics)
150 | 1/11 wwwaa1217 □ [討論] 區塊鍊能應用在電子投… (HatePolitics)
151 | 1/11 wwwaa1217 □ [討論] 爭鮮大家都可以吃幾盤? (HatePolitics)
152 | 1/11 wwwaa1217 □ [討論] 下次選小黨間先休戰先… (HatePolitics)
153 | 1/11 wwwaa1217 □ [討論] 陳柏惟會是新戰神嗎? (HatePolitics)
154 | 1/11 wwwaa1217 □ [討論] 藍綠鐵板一塊不是沒有… (HatePolitics)
155 |
156 | 1/11 teeo □ [討論] 政黑變八卦版了 (HatePolitics)
157 | 1/11 teeo □ [討論] 今天的新聞台很好做節… (HatePolitics)
158 | 1/11 teeo □ [討論] 有沒有感覺到一絲絲的… (HatePolitics)
159 | 1/11 teeo □ [討論] 澳洲燒一輪之後會更茂… (HatePolitics)
160 | 1/11 teeo □ [黑特] 等一下四點之後.... (HatePolitics)
161 | 1/11 teeo □ [討論] 現在開賭盤還有限制嗎? (HatePolitics)
162 | 1/11 teeo □ [討論] 國民黨真的好廢喔 (HatePolitics)
163 | 1/11 teeo □ [討論] 四年後還有誰可以打的? (HatePolitics)
164 | 1/11 teeo □ [討論] 所以女神高鈺婷要回工… (HatePolitics)
165 | 1/11 teeo R: [討論] 蔡公開嗆聲北京當局 (HatePolitics)
166 |
167 | 1/11 sean12345678 □ [討論] 你懷念的已經不在政壇… (HatePolitics)
168 | 1/11 sean12345678 □ [討論] 大解析,看不太到年輕… (HatePolitics)
169 | 1/11 sean12345678 □ [討論] 難道都沒人跟瑞莎同一… (HatePolitics)
170 | 1/11 sean12345678 □ [討論] 民進黨可不可以讓黃國… (HatePolitics)
171 | 1/11 sean12345678 □ [討論] 謝謝大家!未來可以繼… (HatePolitics)
172 | 1/11 sean12345678 □ [討論] 552萬票有多少是不得已…(HatePolitics)
173 | 1/11 sean12345678 □ [討論] 所以單一選區兩票制是… (HatePolitics)
174 |
175 | 1/11 adagiox □ [么吉]請不要發布民調、亮票、…(HatePolitics)
176 | 1/11 adagiox □ [水木甬]adagiox 水木甬365天 (HatePolitics)
177 | 1/11 adagiox □ [討論] Philosophi Naturali…(HatePolitics)
178 | 1/11 adagiox □ [么吉] 目前還輸八卦版,請大… (HatePolitics)
179 | 1/11 adagiox □ [討論] 大家快發文 (HatePolitics)
180 | 1/11 adagiox □ 感謝AIT讓美屬台灣州長直選圓… (HatePolitics)
181 | 1/11 adagiox □ [黑特] 明天能看到國民黨把反… (HatePolitics)
182 | 1/11 adagiox □ [黑特] 再質疑美國阿 (HatePolitics)
183 | 1/11 adagiox □ [討論] 柯文哲想選2024,最後… (HatePolitics)
184 | 1/11 adagiox □ [討論] 我來畫三角形了 (HatePolitics)
185 |
186 | 1/11 GhostFather □ [黑特] 這裡是政黑嗎???(te…(HatePolitics)
187 | 1/11 GhostFather □ [黑特] 為什麼大家都要歧視肥… (HatePolitics)
188 | 1/11 GhostFather □ [討論] 大家五等分姐妹最喜歡誰 (HatePolitics)
189 | 1/11 GhostFather □ [討論] 別緊張!韓支持者較早… (HatePolitics)
190 | 1/11 GhostFather □ [黑特] 韓粉社團管理員也是臥… (HatePolitics)
191 | 1/11 GhostFather □ [討論] 蔡英文破810萬了!!! (HatePolitics)
192 | 1/11 GhostFather □ [討論] 謝龍介還有要請雞排嗎? (HatePolitics)
193 |
194 | 1/11 Hanedas □ [討論] 公車司機還有機師這類… (HatePolitics)
195 | 1/11 Hanedas □ [討論]有個疑問 關於虛報 (HatePolitics)
196 | 1/11 Hanedas □ [討論]小馬哥 小英 怎麼沒有小…(HatePolitics)
197 | 1/11 Hanedas □ [討論]有點驚訝 我以為政壇大… (HatePolitics)
198 | 1/11 Hanedas □ [討論]請問蜜蜂那麼愛抱怨 到… (HatePolitics)
199 | 1/11 Hanedas □ [新聞] 徐佳瑩發文挨轟「青峰… (HatePolitics)
200 | 1/11 Hanedas □ [討論]候選人影像會跳舞的是哪…(HatePolitics)
201 | 1/11 Hanedas □ [討論]中天是不是石內卜電視台?(HatePolitics)
202 | 1/11 Hanedas □ [討論]汐止到底是什麼顏色? (HatePolitics)
203 | 1/11 Hanedas □ [討論]國民黨宣布自行當選的速…(HatePolitics)
204 | 1/11 Hanedas □ [討論]發錢 第一個本島自行宣… (HatePolitics)
205 | 1/11 Hanedas □ [討論]慶祝大同區為臺北市民主…(HatePolitics)
206 | 1/11 Hanedas □ [討論]黃三線是不是可以專心補…(HatePolitics)
207 | 1/11 Hanedas □ [討論]陳柏惟跟蔡昌憲長得好像…(HatePolitics)
208 | 1/11 Hanedas □ [討論]臺灣第1位女總統而且票… (HatePolitics)
209 | 1/11 Hanedas □ [討論]本屆立院「到底」會不會…(HatePolitics)
210 |
211 | 1/11 ukalm □ [討論] 我猜投票所都是滿滿的… (HatePolitics)
212 | 1/11 ukalm □ [討論] 死魚跟Y大離線了嗎? (HatePolitics)
213 | 1/11 ukalm R: [黑特] 給我時代力量4席 (HatePolitics)
214 | 1/11 ukalm R: [討論] 死魚、Y大、黑狗、吸面…(HatePolitics)
215 | 1/11 ukalm R: 爽啦,民眾黨五席!! (HatePolitics)
216 | 1/11 ukalm R: [討論] 搞不懂時代粉牽拖民眾… (HatePolitics)
217 |
218 | 1/11 cblade □ [討論] 政黑什麼時候可以當上P…(HatePolitics)
219 | 1/11 cblade □ [討論] 幫想開票要配什麼 (HatePolitics)
220 | 1/11 cblade R: [新聞] 影/柯文哲不耐投票花… (HatePolitics)
221 | 1/11 cblade R: [討論] 時力政黨票落後,關民… (HatePolitics)
222 | 1/11 cblade R: 爽啦,民眾黨五席!! (HatePolitics)
223 | 1/11 cblade R: [黑特] 柯粉可以噴姚文智 卻不…(HatePolitics)
224 |
225 | 1/11 ray90910 □ [黑特] 這裡怎變得跟八卦版一… (HatePolitics)
226 | 1/11 ray90910 □ [討論] 陳文茜說的這個人會是… (HatePolitics)
227 | 1/11 ray90910 □ [黑特] 是不是很多人覺得投完… (HatePolitics)
228 | 1/11 ray90910 □ [創作] 抽到克蘿伊啦! (HatePolitics)
229 | 1/11 ray90910 □ [黑特] 各位晚上都預計如何看… (HatePolitics)
230 | 1/11 ray90910 □ [討論] 民進黨超級完全執政,… (HatePolitics)
231 | 1/11 ray90910 □ [討論] 時力當初不跟民進黨切… (HatePolitics)
232 | 1/11 ray90910 □ [轉錄] 陳冠廷 FB 柯P會見香港…(HatePolitics)
233 | 1/11 ray90910 □ [討論] 台灣民眾黨政黨票破150…(HatePolitics)
234 | 1/11 ray90910 □ [討論] 民進黨全面連任,還會… (HatePolitics)
235 |
236 | 1/11 miler22020 □ [討論] 肯德基的椒麻炸雞好吃嗎 (HatePolitics)
237 | 1/11 miler22020 □ [討論] 死魚撐住 (HatePolitics)
238 | 1/11 miler22020 □ [討論] 聽說年輕人投票率很高耶 (HatePolitics)
239 | 1/11 miler22020 □ [討論] 3Q有點強耶 (HatePolitics)
240 | 1/11 miler22020 □ [黑特] 給我時代力量4席 (HatePolitics)
241 | 1/11 miler22020 □ [討論] 政黑柯粉討厭的都當選啦 (HatePolitics)
242 | 1/11 miler22020 □ [討論] 謝佩芬 (HatePolitics)
243 |
244 | 1/11 arnold3 □ [討論] 為什麼葉問那麼強大 (HatePolitics)
245 | 1/11 arnold3 □ [討論] 會不會覺得投票很無聊 (HatePolitics)
246 | 1/11 arnold3 □ [討論] 這次韓國瑜獲勝的最大… (HatePolitics)
247 | 1/11 arnold3 □ [討論] 黃國昌現在在想什麼? (HatePolitics)
248 | 1/11 arnold3 □ [討論] 韓國瑜已經證明每三個… (HatePolitics)
249 | 1/11 arnold3 □ [討論] 2024柯文哲+蔡璧如可否…(HatePolitics)
250 |
251 | 1/11 seabox □ [討論] 盒盒買原油正2 然後賠… (HatePolitics)
252 | 1/11 seabox □ [討論] 盒盒想睡覺 但怕睡過頭 (HatePolitics)
253 | 1/11 seabox □ [討論] 中和國光里是哪? (HatePolitics)
254 | 1/11 seabox □ [討論] 揮文預測韓總會贏120萬 (HatePolitics)
255 | 1/11 seabox □ [討論] 東森是在亂灌票嗎? (HatePolitics)
256 | 1/11 seabox □ [討論] 中選會第一個票匭開出… (HatePolitics)
257 | 1/11 seabox □ [討論] 中選會 蔡英文逆轉啦! (HatePolitics)
258 | 1/11 seabox □ [討論] 陳明文看起來很危險喔 (HatePolitics)
259 | 1/11 seabox □ [討論] 韓國瑜在雲林輸超多 我…(HatePolitics)
260 | 1/11 seabox □ [討論] 韓粉明天還會去直播數… (HatePolitics)
261 | 1/11 seabox □ [討論] 所以政黑柯粉有投廢票嗎 (HatePolitics)
262 | 1/11 seabox □ [黑特] 柯粉可以噴姚文智 卻不…(HatePolitics)
263 |
264 | 1/11 godispower □ [討論] 不限版規,那來一張美…(HatePolitics)
265 | 1/11 godispower □ [討論] 其實,還滿感動的,一… (HatePolitics)
266 | 1/11 godispower □ [討論] 仔細一想,蔡正元面對… (HatePolitics)
267 | 1/11 godispower □ [討論] 等一下韓國瑜會說什麼?(HatePolitics)
268 | 1/11 godispower □ [討論] 目前自行宣布當選,民… (HatePolitics)
269 | 1/11 godispower □ [討論] 又是一個欠雞排的 (HatePolitics)
270 | 1/11 godispower R: [討論] 洪慈庸為何廢成這樣? (HatePolitics)
271 | 1/11 godispower □ [討論] 陳柏惟還蠻搞笑的 (HatePolitics)
272 | 1/11 godispower R: [討論] 認真問 國民黨以後總統…(HatePolitics)
273 |
274 | 1/11 nicholas0406 □ [討論] 晚上開票要看哪一個電… (HatePolitics)
275 | 1/11 nicholas0406 □ [討論] 決定了等下八點就去投… (HatePolitics)
276 | 1/11 nicholas0406 □ [討論] 通常大概幾點開票 就差…(HatePolitics)
277 | 1/11 nicholas0406 □ [討論] 反常欸...今年年輕人都…(HatePolitics)
278 | 1/11 nicholas0406 □ [討論] 新的一年 投票新氣象 … (HatePolitics)
279 | 1/11 nicholas0406 □ [討論] 韓總別氣餒這次你是輸… (HatePolitics)
280 | 1/11 nicholas0406 □ [討論] 韓粉哭了 喊說 只有韓… (HatePolitics)
281 | 1/11 nicholas0406 □ [討論] 馬的菸粉,現在韓粉哭… (HatePolitics)
282 | 1/11 nicholas0406 □ [討論] 現實菸粉八百萬 政黑認…(HatePolitics)
283 | 1/11 nicholas0406 □ [討論] 韓總也大輸了,高雄人… (HatePolitics)
284 |
285 | 1/11 lockinboy □ [討論] 今天要怎麼選比較好勒? (HatePolitics)
286 | 1/11 lockinboy □ [討論] 控射時要怎樣冷靜下來… (HatePolitics)
287 | 1/11 lockinboy □ [討論] 有人吃過蟑螂蛋嗎? (HatePolitics)
288 | 1/11 lockinboy □ [討論] 投票所人都湧出馬路了 (HatePolitics)
289 | 1/11 lockinboy □ [討論] 蟑螂今天都在幹嘛? (HatePolitics)
290 | 1/11 lockinboy □ [討論] 佛地魔現在在幹嘛? (HatePolitics)
291 | 1/11 lockinboy □ [討論] 小菸跟DPP勝選後會過什…(HatePolitics)
292 | 1/11 lockinboy □ [討論] 民進黨會推蟑螂陽光法… (HatePolitics)
293 |
294 | 1/11 e741000 □ [討論] 投票投不完會有棄保效… (HatePolitics)
295 | 1/11 e741000 □ [討論] 現在韓有起死回生了嗎 (HatePolitics)
296 | 1/11 e741000 □ [討論] 現在海豚在想什麼 (HatePolitics)
297 | 1/11 e741000 □ [討論] 韓拿了蔡英文多少錢 (HatePolitics)
298 | 1/11 e741000 □ [討論] 韓還有500萬票算好了吧 (HatePolitics)
299 | 1/11 e741000 □ [討論] 讓韓上應該是正確決定吧 (HatePolitics)
300 | 1/11 e741000 □ [討論] 韓以大局為重會怎樣 (HatePolitics)
301 |
302 | 1/11 z739 □ [討論] 請大家一定要踴躍投票 (HatePolitics)
303 | 1/11 z739 □ [討論] 不爽不要投 (HatePolitics)
304 | 1/11 z739 □ [黑特] 我要投廢票啦 (HatePolitics)
305 | 1/11 z739 □ [討論] 有地下賭盤嗎 (HatePolitics)
306 | 1/11 z739 □ [討論] 現在支持蔡英文,來的… (HatePolitics)
307 | 1/11 z739 □ [討論] 韓國瑜是不是粉身碎骨了 (HatePolitics)
308 | 1/11 z739 □ [討論] 下一步,罷免韓國瑜 (HatePolitics)
309 |
310 | 1/11 leoth □ [討論] 今晚海水退潮就知道誰… (HatePolitics)
311 | 1/11 leoth □ [討論] 上面有某篇危險欸! (HatePolitics)
312 | 1/11 leoth □ [討論] 今晚準備好食物飲料慶… (HatePolitics)
313 | 1/11 leoth □ [討論] 10點前老人很多,10點… (HatePolitics)
314 | 1/11 leoth □ [討論] 海水退潮,韓粉脫褲子… (HatePolitics)
315 | 1/11 leoth □ [討論] 晚上去凱道還是KMT黨部…(HatePolitics)
316 | 1/11 leoth □ [討論] 哇!風向變了,憤怒韓… (HatePolitics)
317 | 1/11 leoth □ [討論] 警政署部署160警力在國…(HatePolitics)
318 | 1/11 leoth □ [討論] 看中天,韓總部好多韓… (HatePolitics)
319 | 1/11 leoth □ [討論] 等等韓導上台會說什麼… (HatePolitics)
320 | 1/11 leoth □ [討論] 蔡英文一口氣拉開242萬…(HatePolitics)
321 | 1/11 leoth □ [討論] 看了死魚的最近上線時間 (HatePolitics)
322 | 1/11 leoth □ [討論] 韓導說要重回高雄市長… (HatePolitics)
323 | 1/11 leoth □ [討論] 韓導100%會被罷免!! (HatePolitics)
324 | 1/11 leoth □ [討論] 打韓功臣黃國昌可以改… (HatePolitics)
325 | 1/11 leoth □ [討論] 韓導這次撈到多少選票… (HatePolitics)
326 | 1/11 leoth □ [討論] 22:18分了,死魚還是沒…(HatePolitics)
327 |
328 | 1/11 LAPDSWAT456 □ [討論] 台灣年輕人快出門投票啦 (HatePolitics)
329 | 1/11 LAPDSWAT456 □ [討論] 話 説到底幾歲以下算是… (HatePolitics)
330 | 1/11 LAPDSWAT456 □ [討論] 鄉民不去睡一下,迎接… (HatePolitics)
331 | 1/11 LAPDSWAT456 □ [討論] 吳怡農能拚到這樣真的… (HatePolitics)
332 | 1/11 LAPDSWAT456 □ [討論] 依目前的情勢,罷韓會… (HatePolitics)
333 | 1/11 LAPDSWAT456 □ [討論] 時力粉別灰心,至少時… (HatePolitics)
334 |
335 | 1/11 brella □ [黑特] 幹你娘印章放在高雄市 (HatePolitics)
336 | 1/11 brella □ [黑特] 震撼!夢時代韓總造勢… (HatePolitics)
337 | 1/11 brella □ [討論] 預測六點開始韓國瑜全… (HatePolitics)
338 | 1/11 brella □ [黑特] 2018縣市長剩6席 (HatePolitics)
339 | 1/11 brella □ [黑特] 幹你媽陳柏惟當選不是… (HatePolitics)
340 | 1/11 brella R: [新聞] 蔡英文台南造勢15萬人… (HatePolitics)
341 |
342 | 1/11 ebey30918 R: [討論] 來聊聊大家是何時加入… (HatePolitics)
343 | 1/11 ebey30918 R: [黑特] 幹你娘印章放在高雄市 (HatePolitics)
344 | 1/11 ebey30918 □ [黑特] 越來越多年輕人 (HatePolitics)
345 | 1/11 ebey30918 □ [討論] 現在哪一台比較好看 (HatePolitics)
346 | 1/11 ebey30918 □ [黑特] 黃國昌狀況怎樣 (HatePolitics)
347 | 1/11 ebey30918 R: [黑特] 時力粉滾進來 (HatePolitics)
348 | 1/11 ebey30918 □ [黑特] 民眾黨粉柯粉通通進來… (HatePolitics)
349 | 1/11 ebey30918 □ [黑特] 楊博宇你給我進來 (HatePolitics)
350 | 1/11 ebey30918 □ [討論] 幹 柯文哲明明就可以好…(HatePolitics)
351 | 1/11 ebey30918 R: 爽啦,民眾黨五席!! (HatePolitics)
352 | 1/11 ebey30918 □ [討論] 館長選後談話 (HatePolitics)
353 | 1/11 ebey30918 □ [黑特] 慶祝蔡英文總統得票突… (HatePolitics)
354 |
355 | 1/11 hyoerious □ [討論] 老人傾巢而出????? (HatePolitics)
356 | 1/11 hyoerious □ [新聞] 選總統催出通緝犯! 他…(HatePolitics)
357 | 1/11 hyoerious □ [討論] 所以中國人準備回中國… (HatePolitics)
358 | 1/11 hyoerious □ [討論] 夾手他人自行宣布當選… (HatePolitics)
359 | 1/11 hyoerious □ [討論] 壁爐會不會上啊.......…(HatePolitics)
360 | 1/11 hyoerious □ [討論] 柯粉是不是0作用? (HatePolitics)
361 | 1/11 hyoerious □ [討論] 韓國瑜是不是真的是百… (HatePolitics)
362 | 1/11 hyoerious □ [討論] 剩下的 就是高雄人自己…(HatePolitics)
363 | 1/11 hyoerious □ [討論] 哈哈哈哈哈哈哈哈哈 壁…(HatePolitics)
364 | 1/11 hyoerious □ [討論] 這次國民黨的鐵票是不… (HatePolitics)
365 |
366 | 1/11 oppo5566 □ [新聞] 突取消2班機 趕投票旅…(HatePolitics)
367 | 1/11 oppo5566 □ [討論] 鄉民女神:我不投票 (HatePolitics)
368 | 1/11 oppo5566 □ [討論] 揮文說他會一直笑 (HatePolitics)
369 | 1/11 oppo5566 □ [討論] 韓國瑜目前票數 蔡英文…(HatePolitics)
370 | 1/11 oppo5566 □ [討論] 中天開票好膠著哦 (HatePolitics)
371 | 1/11 oppo5566 □ [討論] 中天蔡英文突然票數暴… (HatePolitics)
372 | 1/11 oppo5566 □ [討論] 陳揮文:我沒有在跟你… (HatePolitics)
373 | 1/11 oppo5566 □ [討論] 民進黨大勝! 以後PTT… (HatePolitics)
374 |
375 | 1/11 isaluku □ [黑特] 老人越來越多 投票越… (HatePolitics)
376 | 1/11 isaluku R: [新聞] 影/柯文哲不耐投票花… (HatePolitics)
377 | 1/11 isaluku □ [黑特] 是不是只剩日本和台灣… (HatePolitics)
378 | 1/11 isaluku □ [黑特] 你各位啊還剩下8分鐘 (HatePolitics)
379 | 1/11 isaluku □ [黑特] 震撼!有人睡到現在該… (HatePolitics)
380 | 1/11 isaluku □ [新聞] 返鄉班機上的一句話 全…(HatePolitics)
381 | 1/11 isaluku □ [黑特] 聯合堅持使用國民黨數… (HatePolitics)
382 | 1/11 isaluku □ [黑特] 中天興奮的報導金門陳… (HatePolitics)
383 | 1/11 isaluku □ [黑特] 蔡暫領先 韓微幅落後1…(HatePolitics)
384 | 1/11 isaluku □ [黑特] 韓總今晚幾點要逼宮 (HatePolitics)
385 |
386 | 1/11 Rrrxddd □ [討論] 排隊時可以幹嘛啊 (HatePolitics)
387 | 1/11 Rrrxddd □ [討論] 感覺投票的人好少 (HatePolitics)
388 | 1/11 Rrrxddd □ [討論] 國際上有在關注這場選… (HatePolitics)
389 | 1/11 Rrrxddd □ [討論] 開票要看 哪一台 啊 (HatePolitics)
390 | 1/11 Rrrxddd □ [討論] 哈哈哈 菸糞準備崩潰囉 (HatePolitics)
391 | 1/11 Rrrxddd □ [討論] 我不懂 菸糞 在高潮什麼 (HatePolitics)
392 | 1/11 Rrrxddd □ [討論] 菸糞們 非常恭喜 噁心… (HatePolitics)
393 | 1/11 Rrrxddd □ [討論] 民眾黨席次那麼多 英… (HatePolitics)
394 |
395 | 1/11 magicbook123 □ [討論] 古代被攻城 為何不把門…(HatePolitics)
396 | 1/11 magicbook123 □ [討論] 候選人一早起來投票 是…(HatePolitics)
397 | 1/11 magicbook123 □ [討論] 有人覺得投開票所的印… (HatePolitics)
398 | 1/11 magicbook123 R: [討論] 公開不投票的網紅多嗎? (HatePolitics)
399 | 1/11 magicbook123 □ [討論] 古代奴隸販售 一般民眾…(HatePolitics)
400 | 1/11 magicbook123 □ [討論] 等等開票 新聞台開票數…(HatePolitics)
401 | 1/11 magicbook123 □ [討論] 等等吳董會在哪一台評… (HatePolitics)
402 | 1/11 magicbook123 □ [討論] 剛剛東森是不是把票提… (HatePolitics)
403 | 1/11 magicbook123 □ [討論] 孫大千是否知道桃園贏… (HatePolitics)
404 | 1/11 magicbook123 □ [討論] 國昌看到賴品妤領先 會…(HatePolitics)
405 | 1/11 magicbook123 □ [討論] 還差7萬票 小英就要拿… (HatePolitics)
406 | 1/11 magicbook123 □ [討論] 小英當選感言不看稿 是…(HatePolitics)
407 | 1/11 magicbook123 □ [討論] 新一屆的立法院長會是… (HatePolitics)
408 | 1/11 magicbook123 □ [討論] 科的市府團隊是不是要… (HatePolitics)
409 | 1/11 magicbook123 □ [討論] 農農 吳怡農 有機會入… (HatePolitics)
410 |
411 | 1/11 tagso □ [討論] 真的都老人投票 (HatePolitics)
412 | 1/11 tagso □ [討論] 今天大概幾點可以確認… (HatePolitics)
413 | 1/11 tagso □ [討論] 今天竟然高鐵到晚上6點…(HatePolitics)
414 | 1/11 tagso □ [討論] 今天大家要看哪一台開票?(HatePolitics)
415 | 1/11 tagso □ [討論] 投票倒數不到3小時了!!! (HatePolitics)
416 | 1/11 tagso □ [討論] 中天等等要怎麼凹? (HatePolitics)
417 | 1/11 tagso □ [討論] 罷韓甚麼時候可以成真? (HatePolitics)
418 | 1/11 tagso □ [討論] 這次dpp選得不好的立委…(HatePolitics)
419 | 1/11 tagso R: [創作] 立委封關預測 (HatePolitics)
420 | 1/11 tagso □ [討論] 只有我覺得民眾黨算是… (HatePolitics)
421 |
422 | 1/11 blink173 □ [討論] 蔡英文戶籍在哪個投票所 (HatePolitics)
423 | 1/11 blink173 □ [討論] 以後投票改為課金制可… (HatePolitics)
424 | 1/11 blink173 □ [討論] 今天丁守中有去ㄊㄡˊ… (HatePolitics)
425 | 1/11 blink173 □ [討論] 王如玄是不是史上最悶… (HatePolitics)
426 | 1/11 blink173 □ [討論] 韓導回籠覺起床沒 (HatePolitics)
427 | 1/11 blink173 □ [討論] kmt今天誰最爽 (HatePolitics)
428 | 1/11 blink173 □ [討論] 吳董今天是不是意氣風發 (HatePolitics)
429 | 1/11 blink173 □ [討論] 韓主席好!韓主席好! (HatePolitics)
430 | 1/11 blink173 □ [討論] 高雄韓輸了40萬票 (HatePolitics)
431 | 1/11 blink173 □ [討論] 中天在討論課綱捏 (HatePolitics)
432 | 1/11 blink173 □ [討論] 高潮來了 高潮來了!! (HatePolitics)
433 | 1/11 blink173 □ [討論] 罷免100%會失敗 (HatePolitics)
434 | 1/11 blink173 □ [討論] 投票率74% (HatePolitics)
435 |
436 | 1/11 ihaveseven □ [討論] 珍煮丹甜到爆 靠 (HatePolitics)
437 | 1/11 ihaveseven □ [討論] 韓粉都去哪裡了 (HatePolitics)
438 | 1/11 ihaveseven □ [討論] 苗栗 新竹縣 花蓮 沒救了(HatePolitics)
439 | 1/11 ihaveseven □ [討論] 吳怡農 賴品妤 陳柏惟… (HatePolitics)
440 | 1/11 ihaveseven □ [討論] 韓國瑜晚上會幹嘛? (HatePolitics)
441 | 1/11 ihaveseven □ [討論] 台中真是個意外的地方 (HatePolitics)
442 |
443 | 1/11 Godfrey0216 □ [討論] 所以昨天韓冰真得出來… (HatePolitics)
444 | 1/11 Godfrey0216 □ [討論] 高雄人真的很愛韓 (HatePolitics)
445 | 1/11 Godfrey0216 □ [討論] 新北這次大輸到底是要… (HatePolitics)
446 | 1/11 Godfrey0216 □ [討論] 民眾黨這次選的算好嗎? (HatePolitics)
447 | 1/11 Godfrey0216 □ [黑特] 免費打了一個廣告~~~ (HatePolitics)
448 | 1/11 Godfrey0216 □ [討論] 李彥秀怎麼沒出來說話? (HatePolitics)
449 | 1/11 Godfrey0216 □ [討論] 侯有什麼立場出來選黨… (HatePolitics)
450 |
451 | 1/11 tel5149 □ [新聞] 影/柯文哲不耐投票花… (HatePolitics)
452 | 1/11 tel5149 □ [新聞] 苗栗投開票所 男子撕毀…(HatePolitics)
453 | 1/11 tel5149 □ [討論] 祭品文 (HatePolitics)
454 | 1/11 tel5149 □ [討論] 中天怕了? (HatePolitics)
455 | 1/11 tel5149 □ [討論] 蘇治芬自行宣布當選 (HatePolitics)
456 | 1/11 tel5149 □ [討論] 顏寬恒輸了!! (HatePolitics)
457 | 1/11 tel5149 □ [討論] 黃國昌現在會後悔嗎 (HatePolitics)
458 | 1/11 tel5149 □ [討論] +<><也自己宣布勝選 (HatePolitics)
459 | 1/11 tel5149 R: [新聞] 國民黨估韓贏28萬票 立…(HatePolitics)
460 | 1/11 tel5149 R: [討論] 祭品文 (HatePolitics)
461 |
462 | 1/11 addison123 □ [討論] 晚上該怎麼慶祝? (HatePolitics)
463 | 1/11 addison123 □ [討論] 我花連人沒投過票的都… (HatePolitics)
464 | 1/11 addison123 □ [討論] 蔡英文要贏幾票才算贏? (HatePolitics)
465 | 1/11 addison123 □ [討論] 花蓮人果然只配待在後… (HatePolitics)
466 | 1/11 addison123 □ [討論] 韓國瑜還有3百多萬票? (HatePolitics)
467 | 1/11 addison123 □ [討論] 我身為花蓮人跟蕭美琴… (HatePolitics)
468 | 1/11 addison123 □ [討論] 高雄市長韓國瑜會自行… (HatePolitics)
469 | 1/11 addison123 □ [討論] 韓國瑜500萬票會不會太…(HatePolitics)
470 | 1/11 addison123 □ [討論] 國際記者會翻譯正妹! (HatePolitics)
471 |
472 | 1/11 bernie90006 □ [討論] 為什麼投票一定要為到… (HatePolitics)
473 | 1/11 bernie90006 □ [討論] 章魚里到底是什麼名詞… (HatePolitics)
474 | 1/11 bernie90006 □ [討論] 欸幾點X粉崩潰潮會開始…(HatePolitics)
475 | 1/11 bernie90006 □ [討論] 剩15分鐘要開票了 你們…(HatePolitics)
476 | 1/11 bernie90006 □ [討論] 看哪台新聞台開票最專業 (HatePolitics)
477 | 1/11 bernie90006 □ [討論] 明天各大報 頭板會怎麼寫(HatePolitics)
478 | 1/11 bernie90006 □ [討論] 韓國瑜說星期一要回去… (HatePolitics)
479 |
480 | 1/11 urban01 □ [討論] 投票率預測 (HatePolitics)
481 | 1/11 urban01 R: [新聞] 影/柯文哲不耐投票花… (HatePolitics)
482 | 1/11 urban01 □ [討論] 東森是藍營西瓜派 (HatePolitics)
483 | 1/11 urban01 □ [討論] 3Q在東森的票數贏顏家 (HatePolitics)
484 | 1/11 urban01 □ 沈智慧 柯程坊 這兩個也太慘 (HatePolitics)
485 | 1/11 urban01 □ [討論] 到底這次投票率多少 (HatePolitics)
486 |
487 | 1/11 Beanoodle □ [討論] 幾歲可以算年輕人? (HatePolitics)
488 | 1/11 Beanoodle □ [討論] 為什麼不去投票不抓去… (HatePolitics)
489 | 1/11 Beanoodle □ [討論] 所以今天的發文是限制… (HatePolitics)
490 | 1/11 Beanoodle □ [討論] 完了,韓國瑜崩了 (HatePolitics)
491 | 1/11 Beanoodle □ [討論] 新潮流小公主要贏了欸 (HatePolitics)
492 | 1/11 Beanoodle □ [討論] 以後顏家還抬得起頭? (HatePolitics)
493 | 1/11 Beanoodle □ [討論] 證明台灣人不吃打弊案… (HatePolitics)
494 | 1/11 Beanoodle □ [討論] TMD到底是小藍還是小綠…(HatePolitics)
495 |
496 | 1/11 berryc □ [討論] 快出門投票啊! (HatePolitics)
497 | 1/11 berryc □ [討論] 五毛網軍呢??? 快起床啊 (HatePolitics)
498 | 1/11 berryc R: [討論] 韓穩了 (HatePolitics)
499 | 1/11 berryc R: [討論] 韓粉怎麼關心起罷免了? (HatePolitics)
500 | 1/11 berryc □ [討論] 高雄開完了? (HatePolitics)
501 | 1/11 berryc □ [討論] 輝文崩潰中 (HatePolitics)
502 | 1/11 berryc □ [討論] 恭喜挺韓大將可以睡到… (HatePolitics)
503 | 1/11 berryc □ [討論] 韓導的敗選感言 (HatePolitics)
504 | 1/11 berryc □ [黑特] 不爽不要投 (HatePolitics)
505 | 1/11 berryc □ [討論] 萬安聲明 (HatePolitics)
506 | 1/11 berryc □ [討論] 韓導,我說高雄那條遮羞…(HatePolitics)
507 | 1/11 berryc □ [討論] 鍾小平是不是先知? (HatePolitics)
508 |
509 | 1/11 ksten1688 □ [討論] 催票,快去投 (HatePolitics)
510 | 1/11 ksten1688 □ [討論] 高速公路大塞車 (HatePolitics)
511 | 1/11 ksten1688 □ [討論] 驚!國家機器介入開票 (HatePolitics)
512 | 1/11 ksten1688 □ [黑特] 高雄 蔡英文 103萬 ; … (HatePolitics)
513 | 1/11 ksten1688 □ [黑特] 韓粉喊要驗票 (HatePolitics)
514 | 1/11 ksten1688 □ [黑特] 民進黨61 國民黨38 民… (HatePolitics)
515 |
516 | 1/11 y2k500077 R: [討論] 有人覺得投開票所的印… (HatePolitics)
517 | 1/11 y2k500077 R: [討論] 柯志恩是同情票太多嗎@@?(HatePolitics)
518 | 1/11 y2k500077 R: [黑特] 民眾黨真的是TMD (HatePolitics)
519 | 1/11 y2k500077 R: [討論] 民眾黨這次選的算好嗎? (HatePolitics)
520 | 1/11 y2k500077 R: [轉錄] 王浩宇:即日起退出綠黨 (HatePolitics)
521 | 1/11 y2k500077 R: [黑特] 柯粉可以噴姚文智 卻不…(HatePolitics)
522 |
523 | 1/11 wanggerger □ [討論] 高速公路大塞車 (HatePolitics)
524 | 1/11 wanggerger □ [討論] 投票打卡在哪 (HatePolitics)
525 | 1/11 wanggerger □ [討論] 韓市長幾點會出來敗選… (HatePolitics)
526 | 1/11 wanggerger □ [討論] 中選會韓市長領先 (HatePolitics)
527 | 1/11 wanggerger □ [討論] 蔡會破700萬吧 (HatePolitics)
528 | 1/11 wanggerger R: [討論] 高雄估票 (HatePolitics)
529 |
530 | 1/11 akway □ [討論] 今年投票率應該不差 (HatePolitics)
531 | 1/11 akway □ [新聞] 返鄉投票潮發威!首都… (HatePolitics)
532 | 1/11 akway □ [討論] 沈智慧要掰了嗎? (HatePolitics)
533 | 1/11 akway □ [討論] 余天自行宣布當選 (HatePolitics)
534 | 1/11 akway □ [討論] 山地原住民民進黨是不… (HatePolitics)
535 | 1/11 akway □ [討論] 驚!!!韓國瑜領先民… (HatePolitics)
536 |
537 | 1/11 as6633208 □ [討論] 今天是不是ptt最乾淨的…(HatePolitics)
538 | 1/11 as6633208 □ [討論] 感謝大家投民眾黨 (HatePolitics)
539 | 1/11 as6633208 □ [討論] 綠蟑螂還是贏了,ptt各…(HatePolitics)
540 | 1/11 as6633208 □ [討論] 有多少人選前家人完全… (HatePolitics)
541 | 1/11 as6633208 □ [討論] 其實這次結果反而對柯… (HatePolitics)
542 | 1/11 as6633208 R: [討論] 證明台灣人不吃打弊案… (HatePolitics)
543 | 1/11 as6633208 □ [討論] 民進黨貶韓策略大成功… (HatePolitics)
544 | 1/11 as6633208 R: [黑特] 老實承認蔡英文做的好… (HatePolitics)
545 | 1/11 as6633208 □ [討論] 菸粉到底在嗨什麼啊?… (HatePolitics)
546 | 1/11 as6633208 □ [討論] 今年的八百萬四年後有… (HatePolitics)
547 | 1/11 as6633208 □ [討論] 搞不懂時代粉牽拖民眾… (HatePolitics)
548 |
549 | 1/11 ChrisDavis □ [討論] 這輩子看過最多年輕人… (HatePolitics)
550 | 1/11 ChrisDavis □ [討論] 為什麼中天可以拍投票… (HatePolitics)
551 | 1/11 ChrisDavis □ [討論] 郭子乾這兩年是不是爽… (HatePolitics)
552 | 1/11 ChrisDavis □ [討論] 中天開場就輸800票 (HatePolitics)
553 | 1/11 ChrisDavis □ [討論] 郭子乾真的很白癡 (HatePolitics)
554 | 1/11 ChrisDavis □ [討論] 可以在韓粉家人前面笑… (HatePolitics)
555 | 1/11 ChrisDavis □ [討論] 有人知道seaman這板友… (HatePolitics)
556 | 1/11 ChrisDavis □ [討論] 韓導一年敗掉三十萬票 (HatePolitics)
557 | 1/11 ChrisDavis □ [討論] 口譯妹子你怎麼省略問題 (HatePolitics)
558 |
559 | 1/11 IronCube □ [黑特] 兩年一次的補刀超爽der…(HatePolitics)
560 | 1/11 IronCube □ [討論] 今晚哪種粉會崩潰啊? (HatePolitics)
561 | 1/11 IronCube □ [討論] 林國慶贏陳明文? (HatePolitics)
562 | 1/11 IronCube R: [討論] 投民眾黨來簽到吧 (HatePolitics)
563 | 1/11 IronCube □ [討論] 哀...時力支持者再不聽…(HatePolitics)
564 | 1/11 IronCube □ [討論] 等等...蔡英文不會噴了…(HatePolitics)
565 | 1/11 IronCube □ [討論] 哀... 芒果乾操作了八… (HatePolitics)
566 |
567 | 1/11 jojoway □ [黑特] 東森開始了 (HatePolitics)
568 | 1/11 jojoway □ [黑特] 吳董開獎 (HatePolitics)
569 | 1/11 jojoway □ [黑特] 就說了 KMT智障 推出個…(HatePolitics)
570 | 1/11 jojoway □ [討論] 寶潔今天好狠好直接 (HatePolitics)
571 | 1/11 jojoway □ [黑特] 沒卵蛋藍何時敢檢討韓導 (HatePolitics)
572 | 1/11 jojoway □ [黑特] KMT就是閹黨 整黨沒種… (HatePolitics)
573 | 1/11 jojoway R: [討論] 身為鐵藍家族對國民黨… (HatePolitics)
574 |
575 | 1/11 KyleSeager □ [討論] 開好中天開票影片了 (HatePolitics)
576 | 1/11 KyleSeager □ [黑特] 國民黨就是廢物!! (HatePolitics)
577 | 1/11 KyleSeager □ [黑特] 憑什麼TMD過10% (HatePolitics)
578 | 1/11 KyleSeager □ [黑特] 丟臉!無恥!國民黨! (HatePolitics)
579 | 1/11 KyleSeager □ [黑特] 欺負弱者有什麼了不起 (HatePolitics)
580 | 1/11 KyleSeager □ [討論] 菸粉崩潰 (HatePolitics)
581 |
582 | 1/11 takizawa5566 □ [討論] 韓粉請進 (HatePolitics)
583 | 1/11 takizawa5566 □ [討論] 還在那邊陳其邁 (HatePolitics)
584 | 1/11 takizawa5566 □ [討論] 幹!陳柏惟贏了! (HatePolitics)
585 | 1/11 takizawa5566 □ [討論] 過半囉 (HatePolitics)
586 | 1/11 takizawa5566 □ [討論] 蔡突破730萬了! (HatePolitics)
587 | 1/11 takizawa5566 □ [討論] 小英最終票數860萬 (HatePolitics)
588 |
589 | 1/11 rodneytw R: [討論] 開票要看 哪一台 啊 (HatePolitics)
590 | 1/11 rodneytw □ [黑特] 中天直播一直卡住,是… (HatePolitics)
591 | 1/11 rodneytw □ [討論] 龍介仙超威,台南韓大… (HatePolitics)
592 | 1/11 rodneytw □ [黑特] 韓國瑜總部沒有國旗海? (HatePolitics)
593 | 1/11 rodneytw □ [黑特] FB韓粉社團今天都沒開… (HatePolitics)
594 | 1/11 rodneytw □ [討論] 韓總該提出選舉無效之… (HatePolitics)
595 |
596 | 1/11 Safin □ [討論] 目前六都得標 蔡英文全…(HatePolitics)
597 | 1/11 Safin □ [討論] 台北市立委 高嘉瑜 許… (HatePolitics)
598 | 1/11 Safin □ [討論] 南投怎麼了? 蔡英文跟…(HatePolitics)
599 | 1/11 Safin □ [討論] 金門 陳玉珍自行宣佈當選(HatePolitics)
600 | 1/11 Safin □ [黑特] 蕭美琴被拉開了! 應該…(HatePolitics)
601 | 1/11 Safin □ [討論] 蘇治芬是怎麼逆轉勝的? (HatePolitics)
602 | 1/11 Safin □ [黑特] 3Q被逆轉了! (HatePolitics)
603 | 1/11 Safin □ [黑特] 蕭美琴自行宣佈敗選 (HatePolitics)
604 | 1/11 Safin □ [黑特] 如果蔡宜芳沒出來選 許…(HatePolitics)
605 | 1/11 Safin □ [討論] 高嘉瑜自行宣佈當選 (HatePolitics)
606 | 1/11 Safin □ [黑特] 韓粉要求驗票 (HatePolitics)
607 |
608 | 1/11 poplc □ [討論] 投票心得 (HatePolitics)
609 | 1/11 poplc □ [討論] KMT要怎麼改革? (HatePolitics)
610 | 1/11 poplc □ [討論] 背骨仔會落選嗎 (HatePolitics)
611 | 1/11 poplc □ [討論] 親韓派的立委候選人幾… (HatePolitics)
612 | 1/11 poplc □ [討論] 吳斯懷會滾嗎 (HatePolitics)
613 | 1/11 poplc □ [討論] 林昶佐居然贏5000票 (HatePolitics)
614 | 1/11 poplc □ [討論] 不分區及僑居國外國民… (HatePolitics)
615 | 1/11 poplc □ [討論] 全部總投票一覽 (HatePolitics)
616 |
617 | 1/11 gofigure □ [討論] 吳怡農可惜了 (HatePolitics)
618 | 1/11 gofigure □ [討論] 3Q幹掉台中王吧 (HatePolitics)
619 | 1/11 gofigure □ [討論] 郭子前超強的吧 (HatePolitics)
620 | 1/11 gofigure □ [討論] 韓在高雄沒大輸耶 (HatePolitics)
621 | 1/11 gofigure □ [討論] 吳敦義被中時辭黨主席 (HatePolitics)
622 | 1/11 gofigure □ [討論] 驗票?? (HatePolitics)
623 |
624 | 1/11 fawangching □ [討論] 宋先生還有機會反敗為… (HatePolitics)
625 | 1/11 fawangching □ [討論] 是不是顏值高的贏的機… (HatePolitics)
626 | 1/11 fawangching □ [討論] 為什麼每台的票數差那… (HatePolitics)
627 | 1/11 fawangching □ [討論] 中天和關鍵時刻可以恢… (HatePolitics)
628 | 1/11 fawangching □ [討論] 以後還有政治人物敢中… (HatePolitics)
629 | 1/11 fawangching R: [討論] 所以砍軍公教年金這方… (HatePolitics)
630 | 1/11 fawangching □ [討論] 韓是不是可惜了 (HatePolitics)
631 |
632 | 1/11 loser1 □ [討論] 台中市 1410投票所開票…(HatePolitics)
633 | 1/11 loser1 □ [討論] 台中市1410投票所立法… (HatePolitics)
634 | 1/11 loser1 □ [討論] 台中市一四零九 投開票所(HatePolitics)
635 | 1/11 loser1 □ [討論] 台中市1410投票所不分… (HatePolitics)
636 | 1/11 loser1 □ [黑特] 2024年大選 (HatePolitics)
637 | 1/11 loser1 R: [討論] 韓大將沈智慧有機會被… (HatePolitics)
638 | 1/11 loser1 R: [討論] 其實我看不懂台中. (HatePolitics)
639 |
640 | 1/11 carpfish □ [討論] 高雄人, 剩下的交給你… (HatePolitics)
641 | 1/11 carpfish □ [討論] 好緊張,蔡韓拉鋸戰! (HatePolitics)
642 | 1/11 carpfish □ [討論] 蔡英文候選總部講話正… (HatePolitics)
643 | 1/11 carpfish □ [討論] 史上最高總統得票數!!! (HatePolitics)
644 | 1/11 carpfish □ [黑特] 高雄應該罷免不掉韓國… (HatePolitics)
645 | 1/11 carpfish □ [黑特] 中視的董智森是在講甚… (HatePolitics)
646 |
647 | 1/11 ketter □ [討論] 國民黨從明天開始轉型… (HatePolitics)
648 | 1/11 ketter □ [黑特] 無情的台灣人 (HatePolitics)
649 | 1/11 ketter □ [討論] 其中肯定有陰謀 (HatePolitics)
650 | 1/11 ketter □ [討論] 今天韓導晚上唱哪一首… (HatePolitics)
651 | 1/11 ketter □ [討論] 說完話就落跑是什麼意思 (HatePolitics)
652 | 1/11 ketter □ [討論] 國台辦這次怎麼這麼軟 (HatePolitics)
653 |
654 | 1/11 cplusplus426 □ [黑特] 所以說為啥不選郭董 (HatePolitics)
655 | 1/11 cplusplus426 □ [黑特] 支持下一屆郭董出山 (HatePolitics)
656 | 1/11 cplusplus426 □ [討論] 八方是不是該出新口味 (HatePolitics)
657 | 1/11 cplusplus426 □ [黑特] 選舉無效之訴 (HatePolitics)
658 | 1/11 cplusplus426 □ [黑特] 喔77777777777777777777 (HatePolitics)
659 | 1/11 cplusplus426 □ [討論] 時力輸民眾黨的原因 (HatePolitics)
660 | 1/11 cplusplus426 R: [討論] 3Q有比當年韓國瑜猛嗎? (HatePolitics)
661 | 1/11 cplusplus426 R: [討論] 今天最失落的應該是老… (HatePolitics)
662 | 1/11 cplusplus426 R: [討論] 2024柯文哲還會出來嗎? (HatePolitics)
663 | 1/11 cplusplus426 □ [討論] 李富城 (HatePolitics)
664 | 1/11 cplusplus426 □ [討論] 800萬 (HatePolitics)
665 | 1/11 cplusplus426 R: [討論] 國民黨有大敗嗎? (HatePolitics)
666 | 1/11 cplusplus426 □ [討論] 彭P打那麼久的論文 (HatePolitics)
667 | 1/11 cplusplus426 R: [討論] 國民黨有大敗嗎? (HatePolitics)
668 | 1/11 cplusplus426 R: [新聞] 要驗票! 韓粉激動包圍…(HatePolitics)
669 | 1/11 cplusplus426 R: [討論] 認真問 國民黨以後總統…(HatePolitics)
670 |
671 | 1/11 soi1dsnake □ [討論] 北北屯要創造歷史了嗎 (HatePolitics)
672 | 1/11 soi1dsnake □ [討論] 2024國民黨還有救世主… (HatePolitics)
673 | 1/11 soi1dsnake R: [討論] 顏寬恒輸了!! (HatePolitics)
674 | 1/11 soi1dsnake □ [討論] 雙方競選總部現況 (HatePolitics)
675 | 1/11 soi1dsnake □ [討論] 交通部長再戰台中市長? (HatePolitics)
676 | 1/11 soi1dsnake □ [討論] 今天如果是韓導當選,記…(HatePolitics)
677 | 1/11 soi1dsnake □ [討論] 張善政接下來的發展 (HatePolitics)
678 |
679 | 1/11 bravee □ [黑特] 洪孟楷居然領先? (HatePolitics)
680 | 1/11 bravee □ [新聞] 快訊/台中市第二選區… (HatePolitics)
681 | 1/11 bravee R: [討論] 我身為花蓮人跟蕭美琴… (HatePolitics)
682 | 1/11 bravee □ [討論] 中天開始說~高雄人不要…(HatePolitics)
683 | 1/11 bravee □ [討論] 中壢選區,真的被時力背…(HatePolitics)
684 | 1/11 bravee □ [討論] 中選會 不分區政黨票 (HatePolitics)
685 | 1/11 bravee □ [討論] 新北市 蔡英文破130萬 (HatePolitics)
686 | 1/11 bravee □ [討論] 接下來~就是高雄人的事…(HatePolitics)
687 |
688 | 1/11 xyyzzz □ [黑特] 目前冷門爆一下 (HatePolitics)
689 | 1/11 xyyzzz □ [討論] 民眾黨支持者應該擔憂吧 (HatePolitics)
690 | 1/11 xyyzzz R: [黑特] 民進黨61 國民黨38 民… (HatePolitics)
691 | 1/11 xyyzzz R: [討論] 柯的眼光是不是真的準 (HatePolitics)
692 | 1/11 xyyzzz R: [討論] 柯的眼光是不是真的準 (HatePolitics)
693 | 1/11 xyyzzz R: [新聞] 「郭家軍」全軍覆沒 傳…(HatePolitics)
694 |
695 | 1/11 ORK □ [黑特] 花蓮國的傅氏王朝~果然…(HatePolitics)
696 | 1/11 ORK □ [討論] 苗栗 : 韓11萬9771 英1…(HatePolitics)
697 | 1/11 ORK □ [討論] 楊瓊瓔vs洪慈庸vs張睿倉 (HatePolitics)
698 | 1/11 ORK □ [討論] 費鴻泰vs許淑華vs蔡宜芳 (HatePolitics)
699 | 1/11 ORK R: [討論] 民眾黨這次選的算好嗎? (HatePolitics)
700 | 1/11 ORK □ [討論] 柯文哲的新任務:2024拱…(HatePolitics)
701 | 1/11 ORK □ [討論] 各縣市 總統選票比例 (HatePolitics)
702 |
703 | 1/11 ilanese R: [討論] 黃國昌最後挺英當小綠 …(HatePolitics)
704 | 1/11 ilanese □ [討論] 選後政治局勢分析 (HatePolitics)
705 | 1/11 ilanese R: [討論] 民眾黨這次選的算好嗎? (HatePolitics)
706 | 1/11 ilanese R: [黑特] 蔡700萬居然比上一屆高…(HatePolitics)
707 | 1/11 ilanese □ [討論] 民進黨跟民眾黨正在爭… (HatePolitics)
708 | 1/11 ilanese □ [討論] 民眾黨應該吸納親民黨… (HatePolitics)
709 | 1/11 ilanese R: [討論] 國昌落選,最大戰犯是… (HatePolitics)
710 | 1/11 ilanese □ [討論] 由政黨票來看,民進黨… (HatePolitics)
711 | 1/11 ilanese R: [新聞] 「郭家軍」全軍覆沒 傳…(HatePolitics)
712 | 1/11 ilanese □ [討論] 該看精神科的話,就應… (HatePolitics)
713 | 1/11 ilanese R: [新聞] 蔡壁如進入國會 盼發揮…(HatePolitics)
714 |
715 | 1/11 Encrypt □ [討論] 吳怡農可以像柯P那樣直…(HatePolitics)
716 | 1/11 Encrypt R: [討論] 吳怡農可以像柯P那樣直…(HatePolitics)
717 | 1/11 Encrypt □ [討論] 韓市長不被罷免的妙法 (HatePolitics)
718 | 1/11 Encrypt □ [討論] 國民黨有大敗嗎? (HatePolitics)
719 | 1/11 Encrypt □ [討論] 來想像一下韓當國民黨… (HatePolitics)
720 | 1/11 Encrypt □ [黑特] 選後第一個該被清算的… (HatePolitics)
721 |
722 | 1/11 wfelix R: [討論] 韓總心裏會希望是三角… (HatePolitics)
723 | 1/11 wfelix R: [討論] 台中 蔡賴差一點破100萬 (HatePolitics)
724 | 1/11 wfelix R: 爽啦,民眾黨五席!! (HatePolitics)
725 | 1/11 wfelix R: [討論] DPP大勝是不是因為香港…(HatePolitics)
726 | 1/11 wfelix R: [討論] 其實我看不懂台中. (HatePolitics)
727 | 1/11 wfelix R: [討論] 民眾黨有幾%投韓? (HatePolitics)
728 | 1/11 wfelix R: [討論] 高虹安傻眼了 (HatePolitics)
729 |
730 | ◆ 沒有發現特定 IP 有 6 篇以上文章
731 |
732 | 內容如有失準,歡迎告知。
733 | 此訊息同步發送給 kero2377
734 |
735 | CodingMan
736 |
--------------------------------------------------------------------------------
/2020OpenTicket.py:
--------------------------------------------------------------------------------
1 |
2 | import sys
3 | import os
4 | import time
5 | import json
6 | import random
7 | import traceback
8 | import PTTLibrary
9 | import threading
10 |
11 | import requests
12 | from requests.packages.urllib3.exceptions import InsecureRequestWarning
13 |
14 | from PTTLibrary import PTT
15 |
16 | requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
17 |
18 |
19 | def getPW():
20 | try:
21 | with open('Account3.txt') as AccountFile:
22 | Account = json.load(AccountFile)
23 | ID = Account['ID']
24 | Password = Account['Password']
25 | except FileNotFoundError:
26 | print('Please note PTT ID and Password in Account.txt')
27 | print('{"ID":"YourID", "Password":"YourPassword"}')
28 | sys.exit()
29 |
30 | return ID, Password
31 |
32 |
33 | if __name__ == '__main__':
34 | os.system('cls')
35 |
36 | ID, Password = getPW()
37 | ptt_bot = PTT.Library()
38 |
39 | try:
40 | try:
41 | ptt_bot.login(
42 | ID,
43 | Password,
44 | )
45 | pass
46 | except PTT.Exceptions.LoginError:
47 | ptt_bot.log('登入失敗')
48 | sys.exit()
49 |
50 | lastcontent = None
51 | while True:
52 |
53 | while True:
54 | # 取得中選會網頁資料
55 |
56 | ticke_1 = 1
57 | ticke_2 = 2
58 | ticke_3 = 3
59 |
60 | try:
61 | response = requests.get(
62 | 'https://www.cec.gov.tw/pc/zh_TW/P1/n00000000000000000.html',
63 | verify=False
64 | )
65 | except requests.exceptions.ConnectionError:
66 | print('取得資料失敗')
67 | continue
68 |
69 | Source = response.text
70 | # print(Source)
71 |
72 | Sourcelines = Source.split('\n')
73 | Sourcelines = [x.strip() for x in Sourcelines if x.strip(
74 | ).startswith('
') + 1:]
79 | line = line[:line.find('<')].replace(',', '')
80 | ticke_1 = int(line)
81 | if i == 2:
82 | line = line[line.find('>') + 1:]
83 | line = line[:line.find('<')].replace(',', '')
84 | ticke_2 = int(line)
85 | if i == 4:
86 | line = line[line.find('>') + 1:]
87 | line = line[:line.find('<')].replace(',', '')
88 | ticke_3 = int(line)
89 |
90 | # 推文格式
91 | # 中選會 2號 1001111 3號 8001111
92 |
93 | Content = f'中選會 韓 {ticke_2} 蔡 {ticke_3}'
94 |
95 | print(Content)
96 | if lastcontent != Content:
97 | lastcontent = Content
98 | break
99 | time.sleep(3)
100 | ptt_bot.getTime()
101 |
102 | ptt_bot.push('Gossiping', PTT.PushType.Arrow,
103 | Content, PostIndex=786734)
104 |
105 | except Exception as e:
106 | traceback.print_tb(e.__traceback__)
107 | print(e)
108 | except KeyboardInterrupt:
109 | pass
110 |
111 | ptt_bot.logout()
112 |
--------------------------------------------------------------------------------
/20字注音文.py:
--------------------------------------------------------------------------------
1 |
2 | import sys
3 | import time
4 | import json
5 | import getpass
6 |
7 | # from time import gmtime, strftime
8 | sys.path.insert(0, 'D:/Git/PTTLibrary')
9 | from PTTLibrary import PTT
10 | import Util
11 |
12 | List = {}
13 |
14 | def PostHandler(Post):
15 | global List
16 |
17 | Author = Post.getAuthor()
18 | if '(' in Author:
19 | Author = Author[:Author.find('(')]
20 | Author = Author.rstrip()
21 |
22 | Title = Post.getTitle()
23 | Content = Post.getContent()
24 | DeleteStatus = Post.getDeleteStatus()
25 |
26 | if Author not in List:
27 | List[Author] = []
28 |
29 | if DeleteStatus == PTT.post_delete_status.NotDeleted:
30 | if '[公告]' in Title:
31 | return
32 | else:
33 | return
34 | if Content == None:
35 | return
36 |
37 | if not '───────────────────────' in Content:
38 | # 不正常文章 @@
39 | return
40 | Content = Content[Content.find('───────────────────────'):]
41 | Content = Content[Content.find('\n') + 1:]
42 | if not '※ 發信站:' in Content:
43 | print('沒有發信站')
44 | print(Title)
45 | print(Content)
46 | return
47 |
48 | Content = Content[:Content.find('※ 發信站:')]
49 | if Content.count('--') > 1:
50 | print(Content)
51 | ContentList = Content.split('\n')
52 | for i in range(len(ContentList)):
53 | line = ContentList[i]
54 |
55 | needRemove = False
56 | if '--' in line:
57 | for ii in range(1, 10):
58 | if i + ii >= len(ContentList):
59 | break
60 | nextline = ContentList[i + ii]
61 | if '※ 發信站:' in nextline:
62 | needRemove = True
63 | break
64 |
65 | if needRemove:
66 | Content = Content[:Content.find(line)]
67 | break
68 | print(Content)
69 | List[Author].append([Title, Content])
70 | def countChinese(input):
71 | result = 0
72 | for char in input:
73 | if '\u4e00' <= char <= '\u9fff':
74 | result += 1
75 | return result
76 | def countJP(input):
77 | result = 0
78 | for char in input:
79 | if '\u30a0' <= char <= '\u30ff':
80 | result += 1
81 | if '\u3040' <= char <= '\u309f':
82 | result += 1
83 | return result
84 | def countEng(input):
85 | # isalpha
86 | result = 0
87 | LastCharInde = -1
88 | for i in range(len(input)):
89 | if LastCharInde != -1 and i <= LastCharInde:
90 | continue
91 |
92 | char = input[i]
93 |
94 | ii = i
95 | while char.isalpha():
96 | LastCharInde = ii
97 | ii += 1
98 | if ii >= len(input):
99 | break
100 | char = input[ii]
101 | if i != ii:
102 | result += 1
103 |
104 | return result
105 |
106 | #unicode japanese hiragana
107 |
108 | if __name__ == '__main__':
109 | try:
110 | with open('Account.txt') as AccountFile:
111 | Account = json.load(AccountFile)
112 | ID = Account['ID']
113 | Password = Account['Password']
114 | except FileNotFoundError:
115 | ID = input('請輸入帳號: ')
116 | Password = getpass.getpass('請輸入密碼: ')
117 |
118 | ptt_bot = PTT.Library(kickOtherLogin=False)
119 | Util.PTTBot = ptt_bot
120 |
121 | StartTime = time.time()
122 |
123 | ErrCode = ptt_bot.login(ID, Password)
124 | if ErrCode != PTT.ErrorCode.Success:
125 | ptt_bot.Log('登入失敗')
126 | sys.exit()
127 |
128 | NewestIndex, Todaty = Util.getToday()
129 | ptt_bot.Log('本日日期: >' + Todaty + '<')
130 |
131 | ptt_bot.Log('最新文章編號: ' + str(NewestIndex))
132 | TodayFirstIndex = Util.findFirstIndex(NewestIndex, Todaty)
133 | ptt_bot.Log('本日最舊文章編號: ' + str(TodayFirstIndex))
134 |
135 | YesterDayNewIndex, YesterDay = Util.getYesterDay(TodayFirstIndex)
136 | ptt_bot.Log('昨日日期: >' + YesterDay + '<')
137 | ptt_bot.Log('昨日最新文章編號: >' + str(YesterDayNewIndex) + '<')
138 | YesterDayOldIndex = Util.findFirstIndex(TodayFirstIndex - 1, YesterDay, show=False)
139 | ptt_bot.Log('昨日最舊文章編號: ' + str(YesterDayOldIndex))
140 |
141 | ErrCode, SuccessCount, DeleteCount = ptt_bot.crawlBoard(Util.current_board, PostHandler, StartIndex=YesterDayOldIndex, EndIndex=NewestIndex)
142 | if ErrCode != PTT.ErrorCode.Success:
143 | ptt_bot.Log('爬行失敗')
144 | sys.exit()
145 |
146 | ptt_bot.Log('爬行成功共 ' + str(SuccessCount) + ' 篇文章 共有 ' + str(DeleteCount) + ' 篇文章被刪除')
147 |
148 | # TargetWord = 'ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄧㄨㄩㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦ'
149 | # 把注音 ㄧ 拿掉,太容易搞混了
150 | TargetWord = 'ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄨㄩㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦ'
151 |
152 | Result_1 = ''
153 | Result_2 = ''
154 | new_line = '\r\n'
155 | for Suspect, ContentList in List.items():
156 | for TitleContent in ContentList:
157 |
158 | Content = TitleContent[1]
159 | isTarget = False
160 | for Target in TargetWord:
161 | if Target in Content:
162 | print('Find >' + Target + '<')
163 | isTarget = True
164 | break
165 | if isTarget:
166 | print('注音文 ======== ' + Suspect + ' ========')
167 | Title = TitleContent[0]
168 | print(Title)
169 | print(Content)
170 |
171 | Result_1 += ' ' + Suspect + ' □ ' + Title + new_line
172 |
173 | Count_Chinese = countChinese(Content)
174 | Count_JP = countJP(Content)
175 | Count_Eng = countEng(Content)
176 |
177 | Total = Count_Chinese + Count_JP + Count_Eng
178 | if Total < 20:
179 | print('20 字 ======== ' + Suspect + ' ========')
180 | Title = TitleContent[0]
181 | print(Title)
182 | print(Content)
183 |
184 | Result_2 += ' ' + Suspect + ' □ ' + Title + new_line
185 |
186 | EndTime = time.time()
187 |
--------------------------------------------------------------------------------
/Demo/README.MD:
--------------------------------------------------------------------------------
1 | # ptt bot demo
2 |
3 | ## first_push_bot.py
4 | 搶頭推機器人
5 |
6 | ## fifth_floor_bot.py
7 | 搶五樓機器人
8 |
9 | ## time_post.py
10 | 準點 PO 文機器人
11 |
12 | ## magician_terminator.py
13 | 魔法師終結者
14 |
15 | 可以針對特定關鍵字寄信給文章作者
16 | ex: 徵男
--------------------------------------------------------------------------------
/Demo/fifth_floor_bot.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import time
3 | import json
4 | from PyPtt import PTT
5 |
6 |
7 | def get_password(password_file):
8 | try:
9 | with open(password_file) as AccountFile:
10 | account = json.load(AccountFile)
11 | ptt_id = account['ID']
12 | password = account['Password']
13 | except FileNotFoundError:
14 | print(f'Please note PTT ID and Password in {password_file}')
15 | print('{"ID":"YourID", "Password":"YourPassword"}')
16 | sys.exit()
17 |
18 | return ptt_id, password
19 |
20 |
21 | if __name__ == '__main__':
22 | id, pw = get_password('../Account.txt')
23 |
24 | board = 'Test'
25 |
26 | ptt_bot = PTT.API()
27 | ptt_bot.login(id, pw, kick_other_login=True)
28 |
29 | last_index = 0
30 |
31 | push_content = [
32 | '冒險蓋 1 樓',
33 | '冒險蓋 2 樓',
34 | '冒險蓋 3 樓',
35 | '冒險蓋 4 樓',
36 | '就是愛搶五樓,送'
37 | ]
38 |
39 | while True:
40 |
41 | newest_index = ptt_bot.get_newest_index(PTT.data_type.index_type.BBS, board=board)
42 | print(f'{board} 板最新文章編號', newest_index)
43 |
44 | if last_index != newest_index and last_index != 0:
45 |
46 | for current_index in range(last_index + 1, newest_index + 1):
47 | post_info = ptt_bot.get_post(board, post_index=current_index)
48 |
49 | for push_index in range(len(post_info.push_list), 5):
50 | ptt_bot.push(board, PTT.data_type.push_type.ARROW, push_content[push_index],
51 | post_index=current_index)
52 |
53 | last_index = newest_index
54 |
55 | try:
56 | time.sleep(2)
57 | except KeyboardInterrupt:
58 | break
59 |
60 | ptt_bot.logout()
61 |
--------------------------------------------------------------------------------
/Demo/first_push_bot.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import time
3 | import json
4 | from PyPtt import PTT
5 |
6 |
7 | def get_password(password_file):
8 | try:
9 | with open(password_file) as AccountFile:
10 | account = json.load(AccountFile)
11 | ptt_id = account['ID']
12 | password = account['Password']
13 | except FileNotFoundError:
14 | print(f'Please note PTT ID and Password in {password_file}')
15 | print('{"ID":"YourID", "Password":"YourPassword"}')
16 | sys.exit()
17 |
18 | return ptt_id, password
19 |
20 |
21 | if __name__ == '__main__':
22 | id, pw = get_password('../Account.txt')
23 |
24 | board = 'Test'
25 |
26 | ptt_bot = PTT.API()
27 | ptt_bot.login(id, pw, kick_other_login=True)
28 |
29 | last_index = 0
30 |
31 | while True:
32 |
33 | newest_index = ptt_bot.get_newest_index(PTT.data_type.index_type.BBS, board=board)
34 | print(f'{board} 板最新文章編號', newest_index)
35 |
36 | if last_index != newest_index and last_index != 0:
37 |
38 | for current_index in range(last_index + 1, newest_index + 1):
39 | ptt_bot.push(board, PTT.data_type.push_type.ARROW, '就是愛搶頭推', post_index=current_index)
40 |
41 | last_index = newest_index
42 |
43 | try:
44 | time.sleep(2)
45 | except KeyboardInterrupt:
46 | break
47 |
48 | ptt_bot.logout()
49 |
--------------------------------------------------------------------------------
/Demo/magician_terminator.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import time
3 | import json
4 | from PyPtt import PTT
5 |
6 |
7 | def get_password(password_file):
8 | try:
9 | with open(password_file) as AccountFile:
10 | account = json.load(AccountFile)
11 | ptt_id = account['ID']
12 | password = account['Password']
13 | except FileNotFoundError:
14 | print(f'Please note PTT ID and Password in {password_file}')
15 | print('{"ID":"YourID", "Password":"YourPassword"}')
16 | sys.exit()
17 |
18 | return ptt_id, password
19 |
20 |
21 | if __name__ == '__main__':
22 | id, pw = get_password('../Account.txt')
23 |
24 | board = 'AllTogether'
25 |
26 | ptt_bot = PTT.API()
27 | ptt_bot.login(id, pw, kick_other_login=True)
28 |
29 | last_index = 0
30 |
31 | while True:
32 |
33 | newest_index = ptt_bot.get_newest_index(PTT.data_type.index_type.BBS, board=board)
34 | print(f'{board} 板最新文章編號', newest_index)
35 |
36 | if last_index != newest_index and last_index != 0:
37 |
38 | for current_index in range(last_index + 1, newest_index + 1):
39 | # new post index here
40 |
41 | post_info = ptt_bot.get_post(board, post_index=current_index)
42 |
43 | author = post_info.author
44 | if '(' in author:
45 | author = author[:author.find('(')].strip()
46 |
47 | if '徵男' in post_info.title:
48 | ptt_bot.mail(author, '哈囉', '你好嗎?', 0)
49 |
50 | last_index = newest_index
51 |
52 | try:
53 | time.sleep(2)
54 | except KeyboardInterrupt:
55 | break
56 |
57 | ptt_bot.logout()
58 |
--------------------------------------------------------------------------------
/Demo/time_post.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import os
3 | import time
4 | import json
5 | import traceback
6 |
7 | from PyPtt import PTT
8 |
9 |
10 | def get_password(password_file):
11 | try:
12 | with open(password_file) as AccountFile:
13 | account = json.load(AccountFile)
14 | ptt_id = account['ID']
15 | password = account['Password']
16 | except FileNotFoundError:
17 | print(f'Please note PTT ID and Password in {password_file}')
18 | print('{"ID":"YourID", "Password":"YourPassword"}')
19 | sys.exit()
20 |
21 | return ptt_id, password
22 |
23 |
24 | if __name__ == '__main__':
25 | os.system('cls')
26 | ptt_bot = PTT.API()
27 |
28 | ID, Password = get_password('../Account2.txt')
29 |
30 | try:
31 | ptt_bot.login(
32 | ID,
33 | Password,
34 | # KickOtherLogin=True
35 | )
36 | except PTT.exceptions.LoginError:
37 | ptt_bot.log('登入失敗')
38 | sys.exit()
39 |
40 | # 預定 PO 文時間的 "前一分鐘"
41 | target_pre_time = '18:06'
42 |
43 | # PO 文看板
44 | current_board = 'Test'
45 | # 文章標題
46 | title = '零秒PO文新版演算法測試'
47 | # 文章內文
48 | content = '''零秒 PO文新版演算法
49 | using PyPtt'''
50 |
51 | content = content.replace('\n', '\r\n')
52 |
53 | print(f'TargetPreTime {target_pre_time}')
54 | print(f'Board {current_board}')
55 | print(f'Title {title}')
56 | print(f'Content {content}')
57 |
58 | ready = False
59 | last_time = None
60 |
61 | try:
62 | while True:
63 |
64 | slow_detect_time = 55
65 | start_time = end_time = time.time()
66 | next_min = False
67 |
68 | last_time = current_time = ptt_bot.get_time()
69 | while end_time - start_time < slow_detect_time:
70 | time.sleep(1)
71 | end_time = time.time()
72 | current_time = ptt_bot.get_time()
73 |
74 | if last_time != current_time:
75 | next_min = True
76 | break
77 |
78 | last_time = current_time
79 | # print(current_time, end='\r')
80 | ptt_bot.log(current_time)
81 | if target_pre_time == current_time:
82 | ready = True
83 |
84 | if next_min:
85 | continue
86 |
87 | if ready:
88 | print('最後準備')
89 | while last_time == current_time:
90 | current_time = ptt_bot.get_time()
91 |
92 | ptt_bot.fast_post(
93 | current_board,
94 | title,
95 | content,
96 | 2,
97 | 3)
98 | break
99 |
100 | except Exception as e:
101 | traceback.print_tb(e.__traceback__)
102 | print(e)
103 | except KeyboardInterrupt:
104 | pass
105 |
106 | print('登出 ')
107 | ptt_bot.logout()
108 |
--------------------------------------------------------------------------------
/FindFunc.py:
--------------------------------------------------------------------------------
1 | import sys
2 | from os import walk
3 |
4 |
5 | def readFile(fname, func, encoding):
6 | with open(fname, 'r', encoding=encoding) as fobj:
7 | content = fobj.read()
8 | if func in content:
9 | print(f'[{encoding}] {fname}')
10 | print(f'找到 {func}')
11 |
12 |
13 | count = 0
14 |
15 |
16 | def FindStrInFile(path, func):
17 |
18 | result = []
19 |
20 | f = []
21 | d = []
22 | fullpath = None
23 | for (dirpath, dirnames, filenames) in walk(path):
24 | fullpath = dirpath
25 | d.extend(dirnames)
26 | f.extend(filenames)
27 | break
28 | if '.git' in d:
29 | d.remove('.git')
30 |
31 | if '.gitattributes' in f:
32 | f.remove('.gitattributes')
33 | if '.gitignore' in f:
34 | f.remove('.gitignore')
35 |
36 | if len(f) == 0:
37 | return
38 |
39 | f = [f'{fullpath}/{x}' for x in f if '.tar' not in x]
40 | # print('\n'.join(f))
41 | # print('\n'.join(d))
42 | # print(fullpath)
43 | # print(d)
44 | global count
45 | count += len(f)
46 |
47 | for fname in f:
48 | try:
49 | readFile(fname, func, 'Big5')
50 | except UnicodeDecodeError:
51 | pass
52 |
53 | try:
54 | readFile(fname, func, 'Utf-8')
55 | except UnicodeDecodeError:
56 | # print(f'{fname} decode error')
57 | pass
58 |
59 | # sys.exit()
60 |
61 | for subpath in d:
62 | FindStrInFile(f'{fullpath}/{subpath}', func)
63 |
64 |
65 | FindStrInFile('D:/Git/pttbbs', '儲存檔案')
66 | print(count)
67 |
--------------------------------------------------------------------------------
/Give/Checker.py:
--------------------------------------------------------------------------------
1 |
2 | import sys
3 | import os
4 | import time
5 | import json
6 | import getpass
7 | import codecs
8 | import traceback
9 | import math
10 | from datetime import date, timedelta
11 | # from time import gmtime, strftime
12 |
13 | from PTTLibrary import PTT
14 | # from .. import Util
15 |
16 | if __name__ == '__main__':
17 |
18 | try:
19 | with open('../Account.txt') as AccountFile:
20 | Account = json.load(AccountFile)
21 | ID = Account['ID']
22 | Password = Account['Password']
23 | except FileNotFoundError:
24 | ID = input('請輸入帳號: ')
25 | Password = getpass.getpass('請輸入密碼: ')
26 |
27 | ptt_bot = PTT.Library()
28 | ptt_bot.login(ID, Password, KickOtherLogin=True)
29 |
30 | current_board = 'give'
31 |
32 | NewestIndex = ptt_bot.getNewestIndex(
33 | PTT.IndexType.BBS,
34 | current_board,
35 | )
36 |
37 | print(f'{current_board} 板最新編號 {NewestIndex}')
38 |
39 | SuspectList = []
40 | CheckList = [
41 | '過期',
42 | '門號',
43 | '市話',
44 | '寬頻',
45 | '網路',
46 | 'sim',
47 | '帳號',
48 | '槍',
49 | '砲',
50 | '彈',
51 | '煙火',
52 | '藥',
53 | '隱形眼鏡',
54 | '隱眼',
55 | '菸',
56 | '煙',
57 | '酒',
58 | 'https://www.ruten.com.tw/',
59 | 'https://shopping.pchome.com.tw/',
60 | 'https://shopee.tw/',
61 | 'momo',
62 | ]
63 | for index in range(0, NewestIndex - 1):
64 |
65 | CurrentIndex = NewestIndex - index
66 |
67 | # print(f'讀取 {CurrentIndex}')
68 |
69 | Post = ptt_bot.getPost(
70 | current_board,
71 | PostIndex=CurrentIndex,
72 | )
73 |
74 | if Post.getDeleteStatus() != PTT.post_delete_status.NotDeleted:
75 | continue
76 |
77 | if '[公告]' in Post.getTitle():
78 | print('搜尋完畢')
79 | break
80 |
81 | Suspect = False
82 |
83 | Content = Post.getOriginPost().lower()
84 | if '--------------------' in Content:
85 | Content = Content[
86 | Content.find('--------------------'):
87 | ]
88 |
89 | if '食品及美妝品請加上到期日' in Content:
90 | Content = Content.replace('食品及美妝品請加上到期日', '')
91 |
92 | Reason = None
93 | for check in CheckList:
94 |
95 | if check in Content:
96 | Suspect = True
97 | if Reason is None:
98 | Reason = f'疑似贈送 [{check}]'
99 | else:
100 | Reason = f'{Reason}\n疑似贈送 [{check}]'
101 |
102 | if Suspect:
103 | print(Post.getOriginPost())
104 | print(Reason)
105 | print('=' * 50)
106 | print('=' * 50)
107 | print('=' * 50)
--------------------------------------------------------------------------------
/IP_Analyzer.py:
--------------------------------------------------------------------------------
1 | import time
2 | import json
3 | import getpass
4 | import math
5 | # from time import gmtime, strftime
6 |
7 | from PTTLibrary import PTT
8 | import Util
9 |
10 | # False True
11 | ask = False
12 | publish = False
13 | mail = False
14 |
15 | # Test = False
16 | author_list = dict()
17 | ip_list = dict()
18 | publish_content = None
19 | new_line = '\r\n'
20 | ptt_bot = PTT.Library(
21 | # LogLevel=PTT.LogLevel.DEBUG,
22 | )
23 |
24 |
25 | def PostHandler(Post):
26 | if Post is None:
27 | return
28 |
29 | DeleteStatus = Post.getDeleteStatus()
30 | if DeleteStatus != PTT.post_delete_status.NotDeleted:
31 | return
32 |
33 | global author_list
34 | global ip_list
35 |
36 | Author = Post.getAuthor()
37 | if Author is None:
38 | return
39 | if '(' in Author:
40 | Author = Author[:Author.find('(')].strip()
41 |
42 | # Author is OK
43 |
44 | IP = Post.getIP()
45 | if IP is None:
46 | return
47 |
48 | Title = Post.getTitle()
49 | if DeleteStatus == PTT.post_delete_status.ByAuthor:
50 | Title = '(本文已被刪除) [' + Author + ']'
51 | elif DeleteStatus == PTT.post_delete_status.ByModerator:
52 | Title = '(本文已被刪除) <' + Author + '>'
53 | elif DeleteStatus == PTT.post_delete_status.ByUnknow:
54 | # Title = '(本文已被刪除) <' + Author + '>'
55 | pass
56 |
57 | if Title is None:
58 | Title = ''
59 | # Title is OK
60 |
61 | if IP not in IPList:
62 | IPList[IP] = []
63 |
64 | if Author not in IPList[IP]:
65 | IPList[IP].append(Author)
66 |
67 | if Author not in AuthorList:
68 | AuthorList[Author] = []
69 |
70 | if IP not in AuthorList[Author]:
71 | AuthorList[Author].append(IP)
72 |
73 | # Post is ok
74 |
75 | if Post.getPushList() is None:
76 | return
77 |
78 | for Push in Post.getPushList():
79 |
80 | Author = Push.getAuthor()
81 | IP = Push.getIP()
82 |
83 | if IP is None:
84 | continue
85 |
86 | if IP not in IPList:
87 | IPList[IP] = []
88 | if Author in IPList[IP]:
89 | continue
90 |
91 | IPList[IP].append(Author)
92 |
93 |
94 | def MultiPO(Board, Moderators, DaysAgo):
95 |
96 | global author_list
97 | global ip_list
98 | global new_line
99 | global ptt_bot
100 | global publish
101 | global ask
102 | global mail
103 |
104 | Util.PTTBot = PTTBot
105 | Util.post_search = None
106 | Util.current_board = Board
107 | Util.Moderators = Moderators
108 |
109 | global publish_content
110 | if PublishContent is None:
111 |
112 | PublishContent = '此內容由 IP 分析程式產生' + NewLine
113 | PublishContent += '由 CodingMan 透過 PTT Library 開發,' + NewLine * 2
114 |
115 | PublishContent += 'PTT Library: https://github.com/Truth0906/PTTLibrary' + NewLine
116 | PublishContent += '開發手冊: https://hackmd.io/@CodingMan/PTTLibraryManual' + NewLine
117 | PublishContent += 'IP 分析程式: https://github.com/Truth0906/PTTModeratorTool' + NewLine
118 |
119 | StartTime = time.time()
120 | AuthorList = dict()
121 | IPList = dict()
122 | CurrentDate = Util.get_date(DaysAgo)
123 |
124 | PTTBot.log(f'開始 {Board} 板 IP 分析')
125 | PTTBot.log(f'從 {CurrentDate} 開始分析')
126 |
127 | Start, _ = Util.find_post_rrange(DaysAgo, show=False)
128 | NewestIndex = PTTBot.getNewestIndex(
129 | PTT.IndexType.Board,
130 | Board=Board,
131 | )
132 | End = NewestIndex
133 | PTTBot.log('編號範圍 ' + str(Start) + ' ~ ' + str(End))
134 |
135 | ErrorPostList, DeleteCount = PTTBot.crawlBoard(
136 | PostHandler,
137 | Util.current_board,
138 | StartIndex=Start,
139 | EndIndex=End,
140 | )
141 |
142 | MultiPOResult = ''
143 | for Suspect, TitleAuthorList in AuthorList.items():
144 |
145 | if len(TitleAuthorList) <= 1:
146 | continue
147 | # print('=' * 5 + ' ' + Suspect + ' ' + '=' * 5)
148 |
149 | if MultiPOResult != '':
150 | MultiPOResult += NewLine
151 | for Title in TitleAuthorList:
152 | MultiPOResult += CurrentDate + ' ' + \
153 | Suspect + ' □ ' + Title + NewLine
154 |
155 | IPResult = ''
156 | for IP, SuspectList in IPList.items():
157 | # print('len:', len(SuspectList))
158 | if len(SuspectList) <= 1:
159 | continue
160 |
161 | # print('IP:', IP)
162 | IPResult += 'IP: ' + IP + NewLine
163 |
164 | for Line in SuspectList:
165 | # print('> ' + CurrentDate + ' ' + Line)
166 | IPResult += CurrentDate + ' ' + Line + NewLine
167 |
168 | EndTime = time.time()
169 |
170 | Title = CurrentDate + f' {Board} 板 IP 分析結果'
171 |
172 | PublishContent += NewLine
173 | PublishContent += '◆ ' + CurrentDate + f' {Board} 板 IP 分析結果'
174 |
175 | Time = math.ceil(EndTime - StartTime)
176 | Min = int(Time / 60)
177 | Sec = int(Time % 60)
178 |
179 | Content = '此內容由自動抓多 PO 程式產生' + NewLine
180 |
181 | Content += '共耗時'
182 | PublishContent += '共耗時'
183 | if Min > 0:
184 | Content += f' {Min} 分'
185 | PublishContent += f' {Min} 分'
186 | Content += f' {Sec} 秒執行完畢' + NewLine * 2
187 | PublishContent += f' {Sec} 秒執行完畢' + NewLine * 2
188 |
189 | Content += '此程式是由 CodingMan 透過 PTT Library 開發,' + NewLine * 2
190 | Content += f'蒐集範圍為 ALLPOST 搜尋 ({Board}) 情況下編號 ' + \
191 | str(Start) + ' ~ ' + str(End) + NewLine
192 | Content += f'共 {End - Start + 1} 篇文章' + NewLine * 2
193 |
194 | PublishContent += f' 蒐集範圍為 ALLPOST 搜尋 ({Board}) 情況下編號 ' + \
195 | str(Start) + ' ~ ' + str(End) + NewLine
196 | PublishContent += f' 共 {End - Start + 1} 篇文章' + NewLine * 2
197 |
198 | if MultiPOResult != '':
199 | Content += MultiPOResult
200 |
201 | MultiPOResult = MultiPOResult.strip()
202 | for line in MultiPOResult.split(NewLine):
203 | PublishContent += ' ' + line + NewLine
204 | else:
205 | Content += '◆ ' + CurrentDate + ' 無人違反多 PO 板規' + NewLine
206 | PublishContent += ' ' + '◆ ' + CurrentDate + ' 無人違反多 PO 板規' + NewLine
207 |
208 | if IPResult != '':
209 | Content += IPResult
210 | IPResult = IPResult.strip()
211 | for line in IPResult.split(NewLine):
212 | PublishContent += ' ' + line + NewLine
213 | else:
214 | Content += NewLine + f'◆ 沒有發現特定 IP 有 {MaxPost + 1} 篇以上文章' + NewLine
215 | PublishContent += NewLine + \
216 | f' ◆ 沒有發現特定 IP 有 {MaxPost + 1} 篇以上文章' + NewLine
217 |
218 | Content += NewLine + '內容如有失準,歡迎告知。' + NewLine
219 | Content += '此訊息同步發送給 ' + ' '.join(Util.Moderators) + NewLine
220 | Content += NewLine
221 | Content += ID
222 |
223 | print(Title)
224 | print(Content)
225 |
226 | if Ask:
227 | Choise = input('要發佈嗎? [Y]').lower()
228 | Publish = (Choise == 'y') or (Choise == '')
229 |
230 | if Mail:
231 | for Moderator in Util.Moderators:
232 | PTTBot.mail(Moderator, Title, Content, 0)
233 | PTTBot.log('寄信給 ' + Moderator + ' 成功')
234 | else:
235 | PTTBot.log('取消寄信')
236 |
237 |
238 | if __name__ == '__main__':
239 |
240 | SearchList = [
241 | # ('Gossiping', ['Bignana'], 1),
242 | ('Wanted', ['gogin'], 1),
243 | ('HatePolitics', ['Neptunium', 'mark2165', 'kero2377'], 1),
244 | ]
245 |
246 | try:
247 | with open('Account.txt') as AccountFile:
248 | Account = json.load(AccountFile)
249 | ID = Account['ID']
250 | Password = Account['Password']
251 | except FileNotFoundError:
252 | ID = input('請輸入帳號: ')
253 | Password = getpass.getpass('請輸入密碼: ')
254 |
255 | ptt_bot.login(ID, Password, KickOtherLogin=True)
256 |
257 | for (current_board, ModeratorList, MaxPost) in SearchList:
258 | MultiPO(current_board, ModeratorList, MaxPost)
259 |
260 | publish_content += new_line + '內容如有失準,歡迎告知。' + new_line
261 | publish_content += 'CodingMan'
262 |
263 | if publish:
264 | CurrentDate = Util.get_date(1)
265 |
266 | ptt_bot.post('Test', CurrentDate + ' 多 PO 結果', publish_content, 1, 0)
267 | ptt_bot.log('在 Test 板發文成功')
268 | else:
269 | ptt_bot.log('取消備份')
270 | ptt_bot.logout()
271 |
--------------------------------------------------------------------------------
/Joke_BooHow.py:
--------------------------------------------------------------------------------
1 |
2 | import sys
3 | import time
4 | import json
5 | import getpass
6 | # from time import gmtime, strftime
7 |
8 | from PTTLibrary import PTT
9 | import Util
10 |
11 | ask = False
12 | publish = False
13 | mail = True
14 | # False True
15 |
16 | author_list = dict()
17 | ip_list = dict()
18 | publish_content = None
19 | new_line = '\r\n'
20 |
21 | if __name__ == '__main__':
22 |
23 | from time import strftime
24 |
25 | dayAgo = 0
26 |
27 | try:
28 | with open('Account.txt') as AccountFile:
29 | Account = json.load(AccountFile)
30 | ID = Account['ID']
31 | Password = Account['Password']
32 | except FileNotFoundError:
33 | ID = input('請輸入帳號: ')
34 | Password = getpass.getpass('請輸入密碼: ')
35 |
36 | LastDate = Util.get_date(dayAgo)
37 |
38 | ptt_bot = PTT.Library(
39 | # LogLevel=PTT.LogLevel.TRACE
40 | )
41 | try:
42 | ptt_bot.login(
43 | ID,
44 | Password,
45 | KickOtherLogin=True
46 | )
47 | except PTT.Exceptions.LoginError:
48 | ptt_bot.log('登入失敗')
49 | sys.exit()
50 | except PTT.Exceptions.ConnectError:
51 | ptt_bot.log('登入失敗')
52 | sys.exit()
53 | except PTT.Exceptions.ConnectionClosed:
54 | ptt_bot.log('登入失敗')
55 | sys.exit()
56 |
57 | run = True
58 |
59 | Index = 0
60 | LastIndex = 0
61 | while run:
62 | LastIndex = Index
63 | while LastIndex == Index:
64 | Time = strftime('%H:%M:%S')
65 | try:
66 | CurrentDate = Util.get_date(dayAgo)
67 | if CurrentDate != LastDate:
68 | # 新的一天!!!清空清單
69 | ptt_bot.logout()
70 |
71 | print('半夜休息中')
72 |
73 | # 暫停六小時
74 | time.sleep(60 * 60 * 6)
75 | print('重新上工!!')
76 | LastDate = CurrentDate
77 | HatePoliticsList = dict()
78 |
79 | ptt_bot.login(ID, Password)
80 |
81 | Index = ptt_bot.getNewestIndex(
82 | PTT.IndexType.BBS,
83 | Board='joke',
84 | )
85 | except PTT.Exceptions.ConnectionClosed:
86 | while True:
87 | try:
88 | ptt_bot.login(
89 | ID,
90 | Password,
91 | KickOtherLogin=True
92 | )
93 | break
94 | except PTT.Exceptions.LoginError:
95 | ptt_bot.log('登入失敗')
96 | time.sleep(1)
97 | except PTT.Exceptions.ConnectError:
98 | ptt_bot.log('登入失敗')
99 | time.sleep(1)
100 | except PTT.Exceptions.ConnectionClosed:
101 | ptt_bot.log('登入失敗')
102 | time.sleep(1)
103 | except PTT.Exceptions.UseTooManyResources:
104 | while True:
105 | try:
106 | ptt_bot.login(
107 | ID,
108 | Password,
109 | KickOtherLogin=True
110 | )
111 | break
112 | except PTT.Exceptions.LoginError:
113 | ptt_bot.log('登入失敗')
114 | time.sleep(1)
115 | except PTT.Exceptions.ConnectError:
116 | ptt_bot.log('登入失敗')
117 | time.sleep(1)
118 | print(f'{Time} 最新編號 {Index}', end='\r')
119 | if LastIndex != Index and LastIndex != 0:
120 | print(f'{Time} 最新編號 {Index}')
121 | break
122 | LastIndex = Index
123 | try:
124 | time.sleep(5)
125 | except:
126 | run = False
127 | break
128 | if not run:
129 | break
130 |
131 | print(Index)
132 | print(LastIndex)
133 | print(f'{Index - LastIndex} 篇新文章')
134 |
135 | for i in range(LastIndex + 1, Index + 1):
136 | print(f'偵測編號 {i} 文章')
137 |
138 | Post = ptt_bot.getPost(
139 | 'joke',
140 | PostIndex=i
141 | )
142 |
143 | if 'how' in Post.getContent().lower():
144 | print('Find how!!!')
145 | ptt_bot.push(
146 | 'joke',
147 | PostIndex=i,
148 | PushType=PTT.PushType.Boo,
149 | PushContent='垃圾號欠噓'
150 | )
151 |
152 | print('=' * 50)
153 |
154 | ptt_bot.logout()
155 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/Ptt25signBot/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.8.7-slim-buster as builder
2 | RUN pip install PyPtt
3 |
4 | FROM builder
5 | WORKDIR /app
6 | CMD ["python", "main.py"]
--------------------------------------------------------------------------------
/Ptt25signBot/Ptt25signBot.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import json
3 | import time
4 | import traceback
5 | from datetime import datetime
6 | import tkinter
7 | from tkinter import messagebox
8 | root = tkinter.Tk()
9 | root.withdraw()
10 |
11 | from PyPtt import PTT
12 |
13 | if __name__ == '__main__':
14 | try:
15 | with open('ptt_info.json', encoding='utf-8') as f:
16 | ptt_info = json.load(f)
17 | except FileNotFoundError:
18 | with open('ptt_info.json', 'w', encoding='utf-8') as f:
19 | sample = '''{
20 | "ptt_id": "你的 PTT ID",
21 | "ptt_pw": "你的 PTT Password",
22 | "post_aid": "簽到文章 AID"
23 | }
24 | '''
25 | f.write(sample)
26 | messagebox.showerror(title='25 周年簽到機器人', message='請修改 ptt_info.json 內的資訊')
27 | sys.exit()
28 |
29 | ptt_bot = PTT.API()
30 | try:
31 | ptt_bot.login(ptt_info['ptt_id'], ptt_info['ptt_pw'])
32 | except PTT.exceptions.WrongIDorPassword:
33 | messagebox.showerror(title='25 周年簽到機器人', message='帳號密碼錯誤,請確認 ptt_info.json 內的資訊')
34 | sys.exit()
35 |
36 | post_info = ptt_bot.get_post(
37 | 'Ptt25sign',
38 | post_aid=ptt_info['post_aid']
39 | )
40 | if not post_info or not post_info.title or not post_info.author:
41 | messagebox.showerror(title='25 周年簽到機器人', message='驗證文章 AID 失敗,請確認 ptt_info.json 內的資訊')
42 | sys.exit()
43 | # print(post_info.title)
44 | # print(post_info.author)
45 |
46 | if ptt_info['ptt_id'] not in post_info.author:
47 | messagebox.showerror(title='25 周年簽到機器人', message='推文 ID 與簽到文 ID 不符,請確認 ptt_info.json 內的資訊')
48 | sys.exit()
49 |
50 | sign_today = False
51 |
52 | today = datetime.now()
53 | today = f'{today.month:02}/{today.day:02}'
54 |
55 | for push in post_info.push_list:
56 | print(push.time)
57 | if today in push.time:
58 | sign_today = True
59 |
60 | if sign_today:
61 | print('今天已經簽到')
62 | else:
63 | print('今天尚未簽到,進行補簽')
64 | ptt_bot.push(
65 | 'Ptt25sign',
66 | PTT.data_type.push_type.ARROW,
67 | '簽到',
68 | post_aid=ptt_info['post_aid']
69 | )
70 | ptt_bot.logout()
71 |
72 | while True:
73 |
74 | today = datetime.now()
75 |
76 | sleep_time = datetime(
77 | today.year,
78 | today.month,
79 | today.day,
80 | 23,
81 | 57,
82 | 0)
83 | delta = sleep_time - today
84 | sleep_sec = delta.seconds
85 | print('預計', sleep_sec + 180, '秒後推文')
86 | print(int((sleep_sec + 180) / 3600), '小時又', int(((sleep_sec + 180) % 3600) / 60), '分鐘')
87 |
88 | time.sleep(sleep_sec)
89 |
90 | # 預定 PO 文時間的 "前一分鐘"
91 | target_pre_time = '23:59'
92 |
93 | # 文章內文
94 | content = '簽到'
95 |
96 | ready = False
97 | last_time = None
98 |
99 | ptt_bot = PTT.API(
100 | # LogLevel=PTT.LogLevel.TRACE
101 | )
102 |
103 | try:
104 |
105 | ptt_bot.login(ptt_info['ptt_id'], ptt_info['ptt_pw'])
106 |
107 | while True:
108 |
109 | slow_detect_time = 55
110 | start_time = end_time = time.time()
111 | next_min = False
112 |
113 | last_time = current_time = ptt_bot.get_time()
114 | while end_time - start_time < slow_detect_time:
115 | time.sleep(1)
116 | end_time = time.time()
117 | current_time = ptt_bot.get_time()
118 |
119 | if last_time != current_time:
120 | next_min = True
121 | break
122 |
123 | last_time = current_time
124 | # print(current_time, end='\r')
125 | ptt_bot.log(current_time)
126 | if target_pre_time == current_time:
127 | ready = True
128 |
129 | if next_min:
130 | continue
131 |
132 | if ready:
133 | print('最後準備')
134 | while last_time == current_time:
135 | current_time = ptt_bot.get_time()
136 | break
137 |
138 | # 批踢踢的一分鐘過了
139 |
140 | ptt_bot.push(
141 | 'Ptt25sign',
142 | PTT.data_type.push_type.ARROW,
143 | content,
144 | post_aid=ptt_info['post_aid']
145 | )
146 |
147 | except Exception as e:
148 | traceback.print_tb(e.__traceback__)
149 | print(e)
150 | except KeyboardInterrupt:
151 | pass
152 |
153 | print('登出 ')
154 | ptt_bot.logout()
155 |
--------------------------------------------------------------------------------
/Ptt25signBot/Ptt25signBot.spec:
--------------------------------------------------------------------------------
1 | # -*- mode: python ; coding: utf-8 -*-
2 |
3 | block_cipher = None
4 |
5 |
6 | a = Analysis(['Ptt25signBot.py'],
7 | pathex=[
8 | 'D:\\Git\\PTTBots\\Ptt25signBot',
9 | 'D:\\Git\\PTTBots\\venv\\Lib\\site-packages'],
10 | binaries=[],
11 | datas=[],
12 | hiddenimports=[],
13 | hookspath=[],
14 | runtime_hooks=[],
15 | excludes=[],
16 | win_no_prefer_redirects=False,
17 | win_private_assemblies=False,
18 | cipher=block_cipher,
19 | noarchive=False)
20 | pyz = PYZ(a.pure, a.zipped_data,
21 | cipher=block_cipher)
22 | exe = EXE(pyz,
23 | a.scripts,
24 | a.binaries,
25 | a.zipfiles,
26 | a.datas,
27 | [],
28 | name='Ptt25signBotV1.0',
29 | debug=False,
30 | bootloader_ignore_signals=False,
31 | strip=False,
32 | upx=False,
33 | upx_exclude=[],
34 | runtime_tmpdir=None,
35 | console=True )
36 |
--------------------------------------------------------------------------------
/Ptt25signBot/README.MD:
--------------------------------------------------------------------------------
1 | # PTT 25 周年簽到機器人
2 | ### 使用方法
3 | 1. 到 Ptt25sign 發一篇簽到文,規則詳見 Ptt25sign 置底文
4 | 2. Q 你自己的簽到文,取得文章代碼 (AID)
5 | 3. 下載此程式,並於 ptt_info.json 中填入你的帳號密碼與簽到文資料 [下載點](https://github.com/PttCodingMan/PTT_bots/releases)
6 | 4. 啟動程式,會固定在零點零時推文簽到
7 | 5. 每天檢查程式是否運作正常
8 |
9 | PS: 如果你覺得很棒,請到 [PyPtt](https://github.com/PttCodingMan/PyPtt) 點個星星喔 >///<
10 |
--------------------------------------------------------------------------------
/Ptt25signBot/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | ptt25signbot:
4 | build: .
5 | container_name: ptt25signbot
6 | restart: unless-stopped
7 | volumes:
8 | - ${PWD}:/app
9 |
--------------------------------------------------------------------------------
/Ptt25signBot/ptt_info.json:
--------------------------------------------------------------------------------
1 | {
2 | "ptt_id": "你的 PTT ID",
3 | "ptt_pw": "你的 PTT Password",
4 | "post_aid": "簽到文章 AID"
5 | }
--------------------------------------------------------------------------------
/PttApp/BoardInfo.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import json
3 |
4 | from PTTLibrary import PTT
5 |
6 |
7 | def getPW():
8 | try:
9 | with open('Account.txt') as AccountFile:
10 | Account = json.load(AccountFile)
11 | ID = Account['ID']
12 | Password = Account['Password']
13 | except FileNotFoundError:
14 | print('Please note PTT ID and Password in Account.txt')
15 | print('{"ID":"YourID", "Password":"YourPassword"}')
16 | sys.exit()
17 |
18 | return ID, Password
19 |
20 |
21 | ID, Password = getPW()
22 |
23 | try:
24 | # Loginout()
25 | # ThreadingTest()
26 |
27 | ptt_bot = PTT.Library(
28 | # LogLevel=PTT.LogLevel.TRACE,
29 | # LogLevel=PTT.LogLevel.DEBUG,
30 | # Host=PTT.Host.PTT2
31 | )
32 | try:
33 | ptt_bot.login(
34 | ID,
35 | Password,
36 | # KickOtherLogin=True
37 | )
38 | pass
39 | except PTT.Exceptions.LoginError:
40 | ptt_bot.log('登入失敗')
41 | sys.exit()
42 |
43 | BoardList = ptt_bot.getBoardList()
44 | # print(' '.join(BoardList))
45 | print(f'總共有 {len(BoardList)} 個板名')
46 | print(f'總共有 {len(set(BoardList))} 個不重複板名')
47 |
48 | ErrorList = []
49 |
50 | result = dict()
51 |
52 | # TempStr = ''
53 | for board in BoardList:
54 | try:
55 | BoardInfo = ptt_bot.getBoardInfo(board)
56 | except PTT.Exceptions.NoSuchBoard:
57 | print(f'No Such Board {board}')
58 | ErrorList.append(board)
59 | result[board] = 'Unknow'
60 | continue
61 |
62 | current = dict()
63 | # current['Name'] = board
64 | # current['Nuser'] = str(BoardInfo.getOnlineUser())
65 |
66 | # Class = BoardInfo.getChineseDes()
67 | # Class = Class[:Class.find('◎')].strip()
68 | # current['Class'] = Class
69 |
70 | # Title = BoardInfo.getChineseDes()
71 | # Title = Title[Title.find('◎') + 1:].strip()
72 | # current['Title'] = Title
73 |
74 | # current['Href'] = f'/bbs/{board}/index.html'
75 | # current['MaxSize'] = 0
76 |
77 | current['線上人數'] = BoardInfo.getOnlineUser()
78 | current['中文敘述'] = BoardInfo.getChineseDes()
79 | current['板主'] = BoardInfo.getModerators()
80 | current['公開狀態'] = BoardInfo.isOpen()
81 | current['隱板時是否可進入十大排行榜'] = BoardInfo.canIntoTopTenWhenHide()
82 | current['是否開放非看板會員發文'] = BoardInfo.canNonBoardMembersPost()
83 | current['是否開放回應文章'] = BoardInfo.canReplyPost()
84 | current['是否開放自刪文章'] = BoardInfo.canSelfDelPost()
85 | current['是否開放推薦文章'] = BoardInfo.canPushPost()
86 | current['是否開放噓文'] = BoardInfo.canBooPost()
87 | current['是否可以快速連推文章'] = BoardInfo.canFastPush()
88 | current['推文最低間隔時間'] = BoardInfo.getMinInterval()
89 | current['推文時是否記錄來源 IP'] = BoardInfo.isPushRecordIP()
90 | current['推文時是否對齊開頭'] = BoardInfo.isPushAligned()
91 | current['板主是否可刪除部份違規文字'] = BoardInfo.canModeratorCanDelIllegalContent()
92 | current['轉錄文章是否自動記錄且是否需要發文權限'] = BoardInfo.isTranPostAutoRecordedAndRequirePostPermissions()
93 | current['冷靜模式'] = BoardInfo.isCoolMode()
94 | current['需要滿十八歲才可進入'] = BoardInfo.isRequire18()
95 | current['發文與推文限制登入次數需多少次以上'] = BoardInfo.getRequireLoginTime()
96 | current['發文與推文限制退文篇數多少篇以下'] = BoardInfo.getRequireIllegalPost()
97 |
98 | result[board] = current
99 |
100 | print(ErrorList)
101 |
102 | with open('BoardList.json', 'w', encoding='utf8') as f:
103 | json.dump(result, f, indent=4, ensure_ascii=False)
104 |
105 | except Exception as e:
106 | traceback.print_tb(e.__traceback__)
107 | print(e)
108 | except KeyboardInterrupt:
109 | pass
110 |
111 | ptt_bot.logout()
112 |
--------------------------------------------------------------------------------
/PttApp/crawler.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import json
3 | import traceback
4 | from PyPtt import PTT
5 | from SingleLog.log import Logger
6 |
7 |
8 | def get_password(password_file):
9 | try:
10 | with open(password_file) as AccountFile:
11 | account = json.load(AccountFile)
12 | ptt_id = account['ID']
13 | password = account['Password']
14 | except FileNotFoundError:
15 | print(f'Please note PTT ID and Password in {password_file}')
16 | print('{"ID":"YourID", "Password":"YourPassword"}')
17 | sys.exit()
18 |
19 | return ptt_id, password
20 |
21 |
22 | def crawl(board):
23 | global result
24 | result[board] = list()
25 |
26 | current_index = ptt_bot.get_newest_index(
27 | PTT.data_type.index_type.BBS,
28 | board=board
29 | )
30 | logger.info('index', current_index)
31 |
32 | for i in range(20):
33 | post_info = ptt_bot.get_post(
34 | board,
35 | post_index=current_index - i
36 | )
37 | if post_info.delete_status != PTT.data_type.post_delete_status.NOT_DELETED:
38 | continue
39 | current_post = dict()
40 |
41 | current_post['author'] = post_info.author
42 | current_post['title'] = post_info.title
43 | current_post['date'] = post_info.date
44 | current_post['content'] = post_info.content
45 |
46 | result[board].append(current_post)
47 |
48 |
49 | if __name__ == '__main__':
50 | logger = Logger('app', Logger.INFO)
51 |
52 | try:
53 |
54 | ptt_id, ptt_pw = get_password('Account.txt')
55 | ptt_bot = PTT.API()
56 |
57 | ptt_bot.login(ptt_id, ptt_pw)
58 |
59 | result = dict()
60 |
61 | crawl('ID_Multi')
62 | crawl('C_Chat')
63 |
64 | with open('PttApp/crawl.json', 'w', encoding='utf-8') as f:
65 | f.write(
66 | json.dumps(result, indent=4, ensure_ascii=False)
67 | )
68 |
69 | except Exception as e:
70 | traceback.print_tb(e.__traceback__)
71 | print(e)
72 | except KeyboardInterrupt:
73 | pass
74 | finally:
75 | ptt_bot.logout()
76 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PTTBots
2 |
3 | ###### PTTBots 是用來蒐集各種 Ptt Bot 的 repo,意思就是我隨手寫的 bot 都放這。
4 | ###### 各種 api 使用範例請參考 [PyPtt](https://github.com/PttCodingMan/PyPtt)
5 | ###### 超貼工具已經包成執行檔釋出,請參考 [releases](https://github.com/PttCodingMan/PTTBots/releases)
6 | ###### 25 周年簽到機器人,請參考 [說明](https://github.com/PttCodingMan/PTT_bots/tree/master/Ptt25signBot)
7 | ###### 想看認真的範例請參考 demo 資料夾與其說明
8 | 需求
9 | -------------------
10 | ###### Python 3.6 or later
11 |
12 | 相依函式庫
13 | -------------------
14 | ###### [PyPtt](https://github.com/PttCodingMan/PyPtt)
15 |
--------------------------------------------------------------------------------
/SearchInBoard.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | import sys
4 | import os
5 | import time
6 | import json
7 | import random
8 | import traceback
9 | import threading
10 |
11 | from PyPtt import PTT
12 |
13 |
14 | def getPW():
15 | try:
16 | with open('Account.txt') as AccountFile:
17 | Account = json.load(AccountFile)
18 | ID = Account['ID']
19 | Password = Account['Password']
20 | except FileNotFoundError:
21 | print('Please note PTT ID and Password in Account.txt')
22 | print('{"ID":"YourID", "Password":"YourPassword"}')
23 | sys.exit()
24 |
25 | return ID, Password
26 |
27 |
28 | if __name__ == '__main__':
29 |
30 | ID, Password = getPW()
31 |
32 | try:
33 |
34 | ptt_bot = PTT.API()
35 | try:
36 | ptt_bot.login(
37 | ID,
38 | Password
39 | )
40 | except PTT.Exceptions.LoginError:
41 | ptt_bot.log('登入失敗')
42 | sys.exit()
43 |
44 | current_board = 'QQBoard'
45 |
46 | newest_index = ptt_bot.get_newest_index(
47 | PTT.data_type.index_type.BBS,
48 | current_board,
49 | )
50 | print(f'{current_board} 最新文章編號 {newest_index}')
51 |
52 | find = False
53 |
54 | for index in range(0, newest_index + 1):
55 |
56 | if index % 100 == 0:
57 | print(f'文章編號 {newest_index - index}')
58 |
59 | post_info = ptt_bot.get_post(
60 | current_board,
61 | post_index=newest_index - index)
62 |
63 | if post_info.origin_post is None:
64 | continue
65 |
66 | if 'QQID' in post_info.origin_post.lower():
67 | print('!!!!!!!!!!!!')
68 | print(post_info.aid)
69 | print('!!!!!!!!!!!!')
70 | break
71 |
72 |
73 |
74 | except Exception as e:
75 | traceback.print_tb(e.__traceback__)
76 | print(e)
77 |
78 | ptt_bot.logout()
79 |
--------------------------------------------------------------------------------
/Start.bat:
--------------------------------------------------------------------------------
1 | #echo off
2 | cls
3 |
4 | pip install PyPtt --upgrade
5 | python MultiPO.py
--------------------------------------------------------------------------------
/Util.py:
--------------------------------------------------------------------------------
1 |
2 | import sys
3 | import os
4 | from PyPtt import PTT
5 | from datetime import date, timedelta, datetime
6 |
7 | ptt_bot = None
8 | current_board = 'ALLPOST'
9 | post_search_type = PTT.data_type.post_search_type.KEYWORD
10 | post_search = '(Wanted)'
11 |
12 |
13 | def get_date(time_del, ptt_sytle=True):
14 | pass_day = date.today() - timedelta(time_del)
15 |
16 | pass_date = pass_day.strftime("%m/%d")
17 | # print('>' + pass_date + '<')
18 | if ptt_sytle and pass_date.startswith('0'):
19 | pass_date = pass_date[1:]
20 |
21 | return pass_date
22 |
23 |
24 | def get_target(date0, date1):
25 |
26 | today = int(datetime.today().strftime('%m%d'))
27 |
28 | if int(date0) > today:
29 | date0 = '0' + date0
30 | else:
31 | date0 = '1' + date0
32 |
33 | if int(date1) > today:
34 | date1 = '0' + date1
35 | else:
36 | date1 = '1' + date1
37 |
38 | return int(date0 + date1)
39 |
40 |
41 | HistoryList = dict()
42 |
43 |
44 | def find_current_date_first(biggest_target, newest_index, day_ago, show=False, oldest_index=1):
45 |
46 | global ptt_bot
47 | global current_board
48 |
49 | # global HistoryList
50 |
51 | # if str(DayAgo) in HistoryList:
52 | # return HistoryList[str(DayAgo)]
53 |
54 | current_date_0 = get_date(
55 | day_ago + 1, ptt_sytle=False).replace('/', '').strip()
56 | current_date_1 = get_date(day_ago, ptt_sytle=False).replace('/', '').strip()
57 | finish_target = get_target(current_date_0, current_date_1)
58 |
59 | if show:
60 | print(f'current_date_0 {current_date_0}')
61 | print(f'current_date_1 {current_date_1}')
62 | print(f'finish_target {finish_target}')
63 |
64 | start_index = oldest_index
65 | end_index = newest_index
66 |
67 | if show:
68 | print(f'start_index {start_index}')
69 | print(f'end_index {end_index}')
70 |
71 | current_index = int((start_index + end_index) / 2)
72 | retry_index = 0
73 |
74 | while True:
75 | if show:
76 | ptt_bot.log('嘗試: ' + str(current_index))
77 | print('Board:', current_board)
78 | print('current_index:', current_index)
79 | print('PostSearchType:', post_search_type)
80 | print('PostSearch:', post_search)
81 |
82 | post_1 = ptt_bot.get_post(
83 | current_board,
84 | post_index=current_index,
85 | search_type=post_search_type,
86 | search_condition=post_search,
87 | query=True
88 | )
89 |
90 | if post_1.list_date is None:
91 | current_index = start_index + retry_index
92 | retry_index += 1
93 | continue
94 |
95 | post_0 = None
96 | retry_index = 0
97 | for i in range(1, 40):
98 |
99 | if current_index - i <= 0:
100 | break
101 |
102 | post_0 = ptt_bot.get_post(
103 | current_board,
104 | post_index=(current_index - i),
105 | search_type=post_search_type,
106 | search_condition=post_search,
107 | query=True
108 | )
109 |
110 | if post_0 is None:
111 | continue
112 | elif post_0.list_date is None:
113 | continue
114 |
115 | if show:
116 | ptt_bot.log('找到上一篇: ' + str(current_index - i))
117 | break
118 |
119 | if post_0 is None:
120 | current_date_0 = '0000'
121 | else:
122 | current_date_0 = post_0.list_date.replace('/', '').strip()
123 |
124 | if len(current_date_0) < 4:
125 | current_date_0 = '0' + current_date_0
126 | current_date_1 = post_1.list_date.replace('/', '').strip()
127 | if len(current_date_1) < 4:
128 | current_date_1 = '0' + current_date_1
129 | current_target = get_target(current_date_0, current_date_1)
130 |
131 | if show:
132 | print('current_date_0: ' + current_date_0)
133 | print('current_date_1: ' + current_date_1)
134 | print('current_target: ' + str(current_target))
135 | print('finish_target: ' + str(finish_target))
136 | print(start_index)
137 | print(end_index)
138 |
139 | if current_target == finish_target:
140 | HistoryList[str(day_ago)] = current_index
141 | return current_index
142 |
143 | if current_target > finish_target:
144 | end_index = current_index - 1
145 | elif current_target < finish_target:
146 | start_index = current_index + 1
147 | current_index = int((start_index + end_index) / 2)
148 |
149 |
150 | def find_post_range(DayAgo, show=False):
151 | global ptt_bot
152 | global current_board
153 | global post_search_type
154 | global post_search
155 |
156 | if show:
157 | print('Board:', current_board)
158 | print('SearchType:', post_search_type)
159 | print('Search:', post_search)
160 |
161 | if post_search is not None:
162 | newest_index = ptt_bot.get_newest_index(
163 | PTT.data_type.index_type.BBS,
164 | board=current_board,
165 | search_type=post_search_type,
166 | search_condition=post_search,
167 | )
168 | else:
169 | newest_index = ptt_bot.getNewestIndex(
170 | PTT.data_type.index_type.BBS,
171 | board=current_board,
172 | )
173 |
174 | if newest_index == -1:
175 | ptt_bot.log('取得 ' + current_board + ' 板最新文章編號失敗')
176 | sys.exit()
177 | ptt_bot.log('取得 ' + current_board + ' 板最新文章編號: ' + str(newest_index))
178 |
179 | if post_search is not None:
180 | post_info = ptt_bot.get_post(
181 | current_board,
182 | post_index=newest_index,
183 | search_type=post_search_type,
184 | search_condition=post_search,
185 | query=True
186 | )
187 | else:
188 | post_info = ptt_bot.getPost(
189 | current_board,
190 | post_index=newest_index,
191 | query=True
192 | )
193 |
194 | current_date_0 = post_info.list_date.replace('/', '').strip()
195 | if len(current_date_0) < 4:
196 | current_date_0 = '0' + current_date_0
197 | current_date_1 = current_date_0
198 | if len(current_date_1) < 4:
199 | current_date_1 = '0' + current_date_1
200 |
201 | biggest_target = get_target(current_date_0, current_date_1)
202 | if show:
203 | print(f'biggest_target {biggest_target}')
204 |
205 | start = find_current_date_first(
206 | biggest_target, newest_index, DayAgo, show=False)
207 |
208 | if show:
209 | print(f'start {start}')
210 |
211 | if DayAgo > 0:
212 | end = find_current_date_first(
213 | biggest_target, newest_index, DayAgo - 1, show=False, oldest_index=start) - 1
214 | elif DayAgo == 0:
215 | end = newest_index
216 |
217 | if show:
218 | print('Result', start, end)
219 |
220 | return start, end
221 |
--------------------------------------------------------------------------------
/check_aid.py:
--------------------------------------------------------------------------------
1 | import json
2 | import sys
3 | import traceback
4 | from PyPtt import PTT
5 |
6 |
7 | def get_password(password_file):
8 | try:
9 | with open(password_file) as AccountFile:
10 | account = json.load(AccountFile)
11 | ptt_id = account['ID']
12 | password = account['Password']
13 | except FileNotFoundError:
14 | print(f'Please note PTT ID and Password in {password_file}')
15 | print('{"ID":"YourID", "Password":"YourPassword"}')
16 | sys.exit()
17 |
18 | return ptt_id, password
19 |
20 |
21 | if __name__ == '__main__':
22 |
23 | with open('check.json', 'r', encoding='utf-8') as f:
24 | data = json.loads(f.read())
25 |
26 | current_board = data['BoardInfo']['Name']
27 | # print(current_board)
28 |
29 | ptt_id, password = get_password('Account.txt')
30 | try:
31 |
32 | ptt_bot = PTT.API()
33 | try:
34 | ptt_bot.login(
35 | ptt_id,
36 | password,
37 | # kick_other_login=True
38 | )
39 | except PTT.exceptions.LoginError:
40 | ptt_bot.log('登入失敗')
41 | sys.exit()
42 | except PTT.exceptions.WrongIDorPassword:
43 | ptt_bot.log('帳號密碼錯誤')
44 | sys.exit()
45 | except PTT.exceptions.LoginTooOften:
46 | ptt_bot.log('請稍等一下再登入')
47 | sys.exit()
48 |
49 | for check_post in data['PostList']:
50 |
51 | # 過濾掉奇怪的字元
52 | current_title = check_post['Title']
53 | current_title = current_title[current_title.rfind(']') + 1:].strip()
54 |
55 | current_author = check_post['Author']
56 |
57 | current_aid = check_post['AID']
58 |
59 | # print(current_aid)
60 |
61 | ptt_post = ptt_bot.get_post(
62 | current_board,
63 | post_aid=current_aid,
64 | query=True)
65 |
66 | if current_title not in ptt_post.title:
67 | print(f'資料標題 [{current_title}]')
68 | print(f'批踢踢標題 [{ptt_post.title}]')
69 | print('標題比對失敗')
70 | continue
71 |
72 | if current_author not in ptt_post.author:
73 | print(f'資料作者 [{current_author}]')
74 | print(f'批踢踢作者 [{ptt_post.author}]')
75 | print('作者比對失敗')
76 | continue
77 |
78 | print('比對成功')
79 |
80 | except Exception as e:
81 | traceback.print_tb(e.__traceback__)
82 | print(e)
83 | except KeyboardInterrupt:
84 | pass
85 |
86 | ptt_bot.logout()
87 |
--------------------------------------------------------------------------------
/clone_searcher/clone_searcher.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import os
3 | import time
4 | import json
5 | import threading
6 | import string
7 | import random
8 | from PyPtt import PTT
9 |
10 |
11 | def get_password(password_file):
12 | try:
13 | with open(password_file) as AccountFile:
14 | account = json.load(AccountFile)
15 | ptt_id = account['ID']
16 | password = account['Password']
17 | except FileNotFoundError:
18 | print(f'Please note PTT ID and Password in {password_file}')
19 | print('{"ID":"YourID", "Password":"YourPassword"}')
20 | sys.exit()
21 |
22 | return ptt_id, password
23 |
24 |
25 | class Searcher:
26 | def __init__(self, id, pw, target):
27 |
28 | self.id = id
29 | self.pw = pw
30 |
31 | ptt_bot = PTT.API()
32 | ptt_bot.login(id, pw, kick_other_login=True)
33 |
34 | target_info = ptt_bot.get_user(target)
35 |
36 | self.target = target
37 |
38 | ptt_bot.logout()
39 |
40 | self.ip_list = set()
41 | self.ip_list.add(target_info.last_ip)
42 |
43 | self.possible_list = list()
44 |
45 | watch_thread = threading.Thread(target=self.watch)
46 | watch_thread.start()
47 |
48 | search_thread = threading.Thread(target=self.search)
49 | search_thread.start()
50 |
51 | def search(self):
52 | search_bot = PTT.API(log_level=PTT.log.level.SILENT)
53 | search_bot.login(self.id, self.pw)
54 |
55 | case_list = list(string.ascii_lowercase)
56 | random.shuffle(case_list)
57 |
58 | while True:
59 |
60 | for c in case_list:
61 | id_list = search_bot.search_user(c)
62 | random.shuffle(id_list)
63 |
64 | for current_user in id_list:
65 | current_user_info = search_bot.get_user(current_user)
66 | print('比對', current_user)
67 | if current_user_info.last_ip in self.ip_list:
68 | self.possible_list.append(current_user)
69 |
70 | def watch(self):
71 | watch_bot = PTT.API(log_level=PTT.log.level.SILENT)
72 | watch_bot.login(id, pw)
73 |
74 | refresh = True
75 |
76 | while True:
77 |
78 | if refresh:
79 | os.system('cls')
80 |
81 | print('目標: ', self.target)
82 | print('IP 清單: ', '\n'.join(self.ip_list))
83 |
84 | print('可能分身清單: ', ' '.join(self.possible_list))
85 | print('====================================')
86 | refresh = False
87 |
88 | target_info = watch_bot.get_user(self.target)
89 | if target_info.last_ip not in self.ip_list:
90 | print('find new ip', target_info.last_ip)
91 | self.ip_list.add(target_info.last_ip)
92 |
93 | time.sleep(3)
94 | if target_info.last_ip not in self.ip_list:
95 | refresh = True
96 |
97 | watch_bot.logout()
98 |
99 |
100 | if __name__ == '__main__':
101 |
102 | if len(sys.argv) != 2:
103 | print('> python clone_search.py target_id')
104 | sys.exit()
105 |
106 | target = sys.argv[1]
107 | print(target)
108 |
109 | id, pw = get_password('../Account.txt')
110 |
111 | s = Searcher(id, pw, target)
112 |
113 |
--------------------------------------------------------------------------------
/first_post/README.MD:
--------------------------------------------------------------------------------
1 | # 八卦首 PO 機器人
2 |
3 | 說明文件
4 | https://codingman.cc/77fa/
5 |
--------------------------------------------------------------------------------
/first_post/first_post.py:
--------------------------------------------------------------------------------
1 | import datetime
2 | import os
3 | import sys
4 | import time
5 | import traceback
6 |
7 | from PyPtt import PTT
8 |
9 | # This script was created using PyPtt 0.9.
10 | # To use this script, please install PyPtt by running the following command:
11 | # pip install PyPtt==0.9.50
12 | ptt_id, ptt_pw = 'Your PTT ID', 'Your PTT PW'
13 | release = False
14 |
15 | if __name__ == '__main__':
16 | time_bot = PTT.API()
17 |
18 | try:
19 | time_bot.login(
20 | ptt_id,
21 | ptt_pw,
22 | kick_other_login=True
23 | )
24 | time_bot.logout()
25 | except PTT.exceptions.LoginError:
26 | time_bot.log('登入失敗 ' + ptt_id)
27 | sys.exit()
28 |
29 | time.sleep(10)
30 |
31 | time_bot = PTT.API()
32 | post_bot = PTT.API()
33 |
34 | for _ in range(5):
35 | try:
36 | time_bot.login(ptt_id, ptt_pw)
37 | time.sleep(5)
38 | post_bot.login(ptt_id, ptt_pw)
39 | break
40 | except PTT.exceptions.LoginError:
41 | time_bot.log('登入失敗 ' + ptt_id)
42 | except PTT.exceptions.LoginTooOften:
43 | time_bot.log('登入太頻繁')
44 | time.sleep(5)
45 |
46 | content = PTT.command.Ctrl_Y * 10 + f'''不好意思,搶到首PO
47 |
48 | 想請問一下有 2023 首PO的八卦嗎?
49 |
50 | --
51 |
52 | Post by https://pyptt.cc/
53 | '''
54 |
55 | if release:
56 | target_pre_time = '23:59'
57 | current_board = 'Gossiping'
58 |
59 | title = '請問有 2023 首PO的八卦嗎?'
60 | post_type = 3
61 |
62 | else:
63 | target_pre_time = (datetime.datetime.now() + datetime.timedelta(minutes=1)).strftime('%H:%M')
64 | current_board = 'Test'
65 |
66 | title = '準點 PO 文測試'
67 | post_type = 1
68 |
69 | content = content.replace('\n', '\r\n')
70 |
71 | print('Python 版本: ' + sys.version)
72 | print(f'目標前一分鐘 {target_pre_time}')
73 | print(f'目標看板 {current_board}')
74 | print(f'文章分類 {post_type}')
75 | print(f'文章標題 {title}')
76 | print(f'文章內文 {content}')
77 |
78 | ready = False
79 | last_time = None
80 |
81 | try:
82 | while True:
83 |
84 | slow_detect_time = 50
85 | start_time = end_time = time.time()
86 | next_min = False
87 |
88 | last_time = current_time = time_bot.get_time()
89 | while end_time - start_time < slow_detect_time:
90 | time.sleep(2)
91 | end_time = time.time()
92 | current_time = time_bot.get_time()
93 | post_bot.get_time()
94 |
95 | if last_time != current_time:
96 | next_min = True
97 | break
98 |
99 | last_time = current_time
100 | # print(current_time, end='\r')
101 | time_bot.log(current_time)
102 | if target_pre_time == current_time:
103 | ready = True
104 |
105 | if next_min:
106 | continue
107 |
108 | if ready:
109 |
110 | post_bot.fast_post_step0(
111 | current_board,
112 | title,
113 | content,
114 | post_type)
115 | time_bot.log('最後準備')
116 | while last_time == current_time:
117 | current_time = time_bot.get_time()
118 |
119 | post_bot.fast_post_step1(0)
120 | # print(time.time())
121 | break
122 |
123 | except Exception as e:
124 | traceback.print_tb(e.__traceback__)
125 | print(e)
126 | except KeyboardInterrupt:
127 | pass
128 | finally:
129 | time_bot.logout()
130 | post_bot.logout()
131 |
132 | print('登出 ')
133 |
--------------------------------------------------------------------------------
/multi_post/MultiPO.py:
--------------------------------------------------------------------------------
1 | import time
2 | import traceback
3 | import math
4 | # from time import gmtime, strftime
5 |
6 | from PyPtt import PTT
7 | import Util
8 |
9 | ask = False
10 | publish = True
11 | mail = False
12 | # False True
13 |
14 | author_list = dict()
15 | ip_list = dict()
16 | publish_content = None
17 | new_line = '\r\n'
18 |
19 |
20 | def post_handler(post_info):
21 | if post_info is None:
22 | return
23 | global author_list
24 | global ip_list
25 |
26 | author = post_info.author
27 | if '(' in author:
28 | author = author[:author.find('(')].strip()
29 |
30 | # author is OK
31 | title = post_info.title
32 | delete_status = post_info.delete_status
33 | ip = post_info.ip
34 |
35 | if delete_status == PTT.data_type.post_delete_status.AUTHOR:
36 | title = '(本文已被刪除) [' + author + ']'
37 | elif delete_status == PTT.data_type.post_delete_status.MODERATOR:
38 | title = '(本文已被刪除) <' + author + '>'
39 | elif delete_status == PTT.data_type.post_delete_status.UNKNOWN:
40 | # title = '(本文已被刪除) <' + author + '>'
41 | pass
42 |
43 | if title is None:
44 | title = ''
45 | # title is OK
46 |
47 | # print(f'==>{author}<==>{title}<')
48 |
49 | if author not in author_list:
50 | author_list[author] = []
51 |
52 | if ip is not None and ip not in ip_list:
53 | ip_list[ip] = []
54 |
55 | if delete_status == PTT.data_type.post_delete_status.NOT_DELETED:
56 | if '[公告]' in title:
57 | return
58 | if ip is not None:
59 | ip_list[ip].append(author + ' □ ' + title)
60 |
61 | author_list[author].append(title)
62 |
63 |
64 | def multi_po(board, max_post):
65 |
66 | global author_list
67 | global ip_list
68 | global new_line
69 | global ptt_bot
70 | global publish
71 | global ask
72 | global mail
73 | global dayAgo
74 |
75 | Util.ptt_bot = ptt_bot
76 | Util.post_search = f'({board})'
77 |
78 | global publish_content
79 | if publish_content is None:
80 |
81 | publish_content = '此內容由抓超貼程式產生並張貼' + new_line
82 | publish_content += '由 CodingMan 透過 PyPtt 開發' + new_line * 2
83 |
84 | publish_content += f'PyPtt 版本: {PTT.version.V}' + new_line
85 |
86 | start_time = time.time()
87 | author_list = dict()
88 | ip_list = dict()
89 | current_date = Util.get_date(dayAgo)
90 |
91 | ptt_bot.log(f'開始 {board} 板昨天的超貼偵測')
92 | ptt_bot.log('日期: ' + current_date)
93 | start, end = Util.find_post_range(dayAgo, show=False)
94 | ptt_bot.log('編號範圍 ' + str(start) + ' ~ ' + str(end))
95 |
96 | ErrorPostList, DeleteCount = ptt_bot.crawl_board(
97 | PTT.data_type.index_type.BBS,
98 | post_handler,
99 | Util.current_board,
100 | start_index=start,
101 | end_index=end,
102 | search_type=Util.post_search_type,
103 | search_condition=Util.post_search,
104 | query=True,
105 | )
106 |
107 | end_time = time.time()
108 |
109 | multi_po_result = ''
110 | for Suspect, TitleAuthorList in author_list.items():
111 |
112 | if len(TitleAuthorList) <= max_post:
113 | continue
114 | # print('=' * 5 + ' ' + Suspect + ' ' + '=' * 5)
115 |
116 | if multi_po_result != '':
117 | multi_po_result += new_line
118 | for title in TitleAuthorList:
119 | if not title.startswith('R:'):
120 | multi_po_result += current_date + ' ' + \
121 | Suspect + ' □ ' + title + new_line
122 | else:
123 | multi_po_result += current_date + ' ' + \
124 | Suspect + ' ' + title + new_line
125 |
126 | ip_result = ''
127 | for IP, SuspectList in ip_list.items():
128 | # print('len:', len(SuspectList))
129 | if len(SuspectList) <= max_post:
130 | continue
131 |
132 | # print('IP:', IP)
133 | ip_result += 'IP: ' + IP + new_line
134 |
135 | for Line in SuspectList:
136 | # print('> ' + current_date + ' ' + Line)
137 | ip_result += current_date + ' ' + Line + new_line
138 |
139 | title = current_date + f' {board} 板超貼結果'
140 |
141 | publish_content += new_line
142 | publish_content += f'◆ {board} 板超貼結果'
143 |
144 | time_temp = math.ceil(end_time - start_time)
145 | min_ = int(time_temp / 60)
146 | sec = int(time_temp % 60)
147 |
148 | content = '此內容由抓超貼程式產生' + new_line
149 |
150 | content += '共耗時'
151 | publish_content += '共耗時'
152 | if min_ > 0:
153 | content += f' {min_} 分'
154 | publish_content += f' {min_} 分'
155 | content += f' {sec} 秒執行完畢' + new_line * 2
156 | publish_content += f' {sec} 秒執行完畢' + new_line * 2
157 |
158 | content += '此程式是由 CodingMan 透過 PyPtt 開發,' + new_line * 2
159 | content += f'蒐集範圍為 ALLPOST 搜尋 ({board}) 情況下編號 ' + \
160 | str(start) + ' ~ ' + str(end) + new_line
161 | content += f'共 {end - start + 1} 篇文章' + new_line * 2
162 |
163 | publish_content += f' 蒐集範圍為 ALLPOST 搜尋 ({board}) 情況下編號 ' + \
164 | str(start) + ' ~ ' + str(end) + new_line
165 | publish_content += f' 共 {end - start + 1} 篇文章' + new_line * 2
166 |
167 | if multi_po_result != '':
168 | content += multi_po_result
169 |
170 | multi_po_result = multi_po_result.strip()
171 | for line in multi_po_result.split(new_line):
172 | publish_content += ' ' + line + new_line
173 | else:
174 | content += '◆ 無人違反超貼板規' + new_line
175 | publish_content += ' ' + '◆ 無人違反超貼板規' + new_line
176 |
177 | if ip_result != '':
178 | content += ip_result
179 | ip_result = ip_result.strip()
180 | for line in ip_result.split(new_line):
181 | publish_content += ' ' + line + new_line
182 | else:
183 | content += new_line + f'◆ 沒有發現特定 IP 有 {max_post + 1} 篇以上文章' + new_line
184 | publish_content += new_line + \
185 | f' ◆ 沒有發現特定 IP 有 {max_post + 1} 篇以上文章' + new_line
186 |
187 | content += new_line + '內容如有失準,歡迎告知。' + new_line
188 | # content += '此訊息同步發送給 ' + ' '.join(Util.Moderators) + new_line
189 | content += new_line
190 | content += ptt_id
191 |
192 | # print(title)
193 | # print(content)
194 |
195 | # with open('Test.txt', 'w', encoding='utf8') as in_file:
196 | # in_file.write(content)
197 |
198 | if ask:
199 | choise = input('要發佈嗎? [Y]').lower()
200 | publish = (choise == 'y') or (choise == '')
201 |
202 |
203 | if __name__ == '__main__':
204 |
205 | dayAgo = 1
206 |
207 | current_board = input('請輸入看板名稱: ')
208 | max_post = int(input('請輸入每天不得超過幾篇: '))
209 | print('註: 因本工具原理為爬行會保留被刪除文章的 ALLPOST 版,此板沒有網頁版所以需要帳密')
210 | print('如有安全疑慮,可自行取用原始碼執行')
211 | print('https://github.com/PttCodingMan/PTT_bots/tree/master/multi_post')
212 | ptt_id = input('請輸入帳號: ')
213 | password = input('請輸入密碼: ')
214 |
215 | ptt_bot = PTT.API(
216 | # LogLevel=PTT.LogLevel.TRACE
217 | )
218 | ptt_bot.login(ptt_id, password)
219 |
220 | try:
221 | multi_po(current_board, max_post)
222 |
223 | publish_content += new_line + '超貼工具原始碼' + new_line
224 | publish_content += 'https://github.com/PttCodingMan/PTT_bots/tree/master/multi_post' + new_line
225 | publish_content += '超貼工具直接打包下載' + new_line
226 | publish_content += 'https://github.com/PttCodingMan/PTTBots/releases' + new_line
227 |
228 | CurrentDate = Util.get_date(dayAgo)
229 | title = f'{current_board} {CurrentDate} 超貼結果'
230 |
231 | print(title)
232 | print(publish_content)
233 |
234 | if publish:
235 | ptt_bot.post('Test', title, publish_content, 1, 0)
236 | ptt_bot.log('在 Test 板發文成功')
237 | else:
238 | ptt_bot.log('取消備份')
239 | except Exception as e:
240 | traceback.print_tb(e.__traceback__)
241 | print(e)
242 | except KeyboardInterrupt:
243 | pass
244 |
245 | ptt_bot.logout()
246 |
247 | input('按 Enter 結束')
248 |
--------------------------------------------------------------------------------
/multi_post/MultiPO.spec:
--------------------------------------------------------------------------------
1 | # -*- mode: python ; coding: utf-8 -*-
2 |
3 | block_cipher = None
4 |
5 |
6 | a = Analysis(['MultiPO.py'],
7 | pathex=['D:\\git\\PTTBots'],
8 | binaries=[],
9 | datas=[],
10 | hiddenimports=[],
11 | hookspath=[],
12 | runtime_hooks=[],
13 | excludes=[],
14 | win_no_prefer_redirects=False,
15 | win_private_assemblies=False,
16 | cipher=block_cipher,
17 | noarchive=False)
18 | pyz = PYZ(a.pure, a.zipped_data,
19 | cipher=block_cipher)
20 | exe = EXE(pyz,
21 | a.scripts,
22 | a.binaries,
23 | a.zipfiles,
24 | a.datas,
25 | [],
26 | name='MultiPO',
27 | debug=False,
28 | bootloader_ignore_signals=False,
29 | strip=False,
30 | upx=False,
31 | upx_exclude=[],
32 | runtime_tmpdir=None,
33 | console=True )
34 |
--------------------------------------------------------------------------------
/multi_post/MultiPO_RealTime.py:
--------------------------------------------------------------------------------
1 |
2 | import sys
3 | import time
4 | import json
5 | import getpass
6 | import traceback
7 | import math
8 | # from time import gmtime, strftime
9 |
10 | from PTTLibrary import PTT
11 | import Util
12 |
13 | ask = False
14 | publish = False
15 | mail = True
16 | # False True
17 |
18 | author_list = dict()
19 | ip_list = dict()
20 | publish_content = None
21 | new_line = '\r\n'
22 |
23 |
24 | def PostHandler(Post):
25 | if Post is None:
26 | return
27 | global author_list
28 | global ip_list
29 |
30 | Author = Post.getAuthor()
31 | if '(' in Author:
32 | Author = Author[:Author.find('(')].strip()
33 |
34 | # Author is OK
35 | Title = Post.getTitle()
36 | DeleteStatus = Post.getDeleteStatus()
37 | IP = Post.getIP()
38 |
39 | if DeleteStatus == PTT.post_delete_status.ByAuthor:
40 | Title = '(本文已被刪除) [' + Author + ']'
41 | elif DeleteStatus == PTT.post_delete_status.ByModerator:
42 | Title = '(本文已被刪除) <' + Author + '>'
43 | elif DeleteStatus == PTT.post_delete_status.ByUnknow:
44 | # Title = '(本文已被刪除) <' + Author + '>'
45 | pass
46 |
47 | if Title is None:
48 | Title = ''
49 | # Title is OK
50 |
51 | # print(f'==>{Author}<==>{Title}<')
52 |
53 | if Author not in AuthorList:
54 | AuthorList[Author] = []
55 |
56 | if IP is not None and IP not in IPList:
57 | IPList[IP] = []
58 |
59 | if DeleteStatus == PTT.post_delete_status.NotDeleted:
60 | if '[公告]' in Title:
61 | return
62 | if IP is not None:
63 | IPList[IP].append(Author + ' □ ' + Title)
64 |
65 | AuthorList[Author].append(Title)
66 |
67 |
68 | def MultiPO(Board, Moderators, MaxPost, Handler):
69 |
70 | global author_list
71 | global ip_list
72 | global new_line
73 | global ptt_bot
74 | global publish
75 | global ask
76 | global mail
77 | global dayAgo
78 |
79 | Util.PTTBot = PTTBot
80 | Util.post_search = f'({Board})'
81 | Util.Moderators = Moderators
82 |
83 | global publish_content
84 | if PublishContent is None:
85 |
86 | PublishContent = '此內容由抓多 PO 程式產生' + NewLine
87 | PublishContent += '由 CodingMan 透過 PTT Library 開發,' + NewLine * 2
88 |
89 | PublishContent += 'PTT Library: https://github.com/Truth0906/PTTLibrary' + NewLine
90 | PublishContent += '開發手冊: https://hackmd.io/@CodingMan/PTTLibraryManual' + NewLine
91 | PublishContent += '抓多 PO 程式: https://github.com/Truth0906/PTTModeratorTool' + NewLine
92 |
93 | StartTime = time.time()
94 | AuthorList = dict()
95 | IPList = dict()
96 | CurrentDate = Util.get_date(dayAgo)
97 |
98 | # PTTBot.log(f'開始 {Board} 板昨天的多 PO 偵測')
99 | # PTTBot.log('日期: ' + CurrentDate)
100 | Start, End = Util.find_post_rrange(dayAgo, show=False)
101 | PTTBot.log('編號範圍 ' + str(Start) + ' ~ ' + str(End))
102 |
103 | ErrorPostList, DeleteCount = PTTBot.crawlBoard(
104 | PostHandler,
105 | PTT.IndexType.BBS,
106 | Util.current_board,
107 | StartIndex=Start,
108 | EndIndex=End,
109 | SearchType=Util.post_search_type,
110 | SearchCondition=Util.post_search,
111 | Query=True,
112 | )
113 |
114 | EndTime = time.time()
115 |
116 | MultiPOResult = ''
117 | for Suspect, TitleAuthorList in AuthorList.items():
118 |
119 | if len(TitleAuthorList) <= MaxPost:
120 | continue
121 | # print('=' * 5 + ' ' + Suspect + ' ' + '=' * 5)
122 |
123 | if MultiPOResult != '':
124 | MultiPOResult += NewLine
125 | for Title in TitleAuthorList:
126 | MultiPOResult += CurrentDate + ' ' + \
127 | Suspect + ' □ ' + Title + NewLine
128 |
129 | IPResult = ''
130 | for IP, SuspectList in IPList.items():
131 | # print('len:', len(SuspectList))
132 | if len(SuspectList) <= MaxPost:
133 | continue
134 |
135 | # print('IP:', IP)
136 | IPResult += 'IP: ' + IP + NewLine
137 |
138 | for Line in SuspectList:
139 | # print('> ' + CurrentDate + ' ' + Line)
140 | IPResult += CurrentDate + ' ' + Line + NewLine
141 |
142 | Title = CurrentDate + f' {Board} 板多 PO 結果'
143 |
144 | PublishContent += NewLine
145 | PublishContent += f'◆ {Board} 板多 PO 結果'
146 |
147 | Time = math.ceil(EndTime - StartTime)
148 | Min = int(Time / 60)
149 | Sec = int(Time % 60)
150 |
151 | Content = '此內容由抓多 PO 程式產生' + NewLine
152 |
153 | Content += '共耗時'
154 | PublishContent += '共耗時'
155 | if Min > 0:
156 | Content += f' {Min} 分'
157 | PublishContent += f' {Min} 分'
158 | Content += f' {Sec} 秒執行完畢' + NewLine * 2
159 | PublishContent += f' {Sec} 秒執行完畢' + NewLine * 2
160 |
161 | Content += '此程式是由 CodingMan 透過 PTT Library 開發,' + NewLine * 2
162 | Content += f'蒐集範圍為 ALLPOST 搜尋 ({Board}) 情況下編號 ' + \
163 | str(Start) + ' ~ ' + str(End) + NewLine
164 | Content += f'共 {End - Start + 1} 篇文章' + NewLine * 2
165 |
166 | PublishContent += f' 蒐集範圍為 ALLPOST 搜尋 ({Board}) 情況下編號 ' + \
167 | str(Start) + ' ~ ' + str(End) + NewLine
168 | PublishContent += f' 共 {End - Start + 1} 篇文章' + NewLine * 2
169 |
170 | if MultiPOResult != '':
171 | Content += MultiPOResult
172 |
173 | MultiPOResult = MultiPOResult.strip()
174 | for line in MultiPOResult.split(NewLine):
175 | PublishContent += ' ' + line + NewLine
176 | else:
177 | Content += '◆ 無人違反多 PO 板規' + NewLine
178 | PublishContent += ' ' + '◆ 無人違反多 PO 板規' + NewLine
179 |
180 | if IPResult != '':
181 | Content += IPResult
182 | IPResult = IPResult.strip()
183 | for line in IPResult.split(NewLine):
184 | PublishContent += ' ' + line + NewLine
185 | else:
186 | Content += NewLine + f'◆ 沒有發現特定 IP 有 {MaxPost + 1} 篇以上文章' + NewLine
187 | PublishContent += NewLine + \
188 | f' ◆ 沒有發現特定 IP 有 {MaxPost + 1} 篇以上文章' + NewLine
189 |
190 | Content += NewLine + '內容如有失準,歡迎告知。' + NewLine
191 | Content += '此訊息同步發送給 ' + ' '.join(Util.Moderators) + NewLine
192 | Content += NewLine
193 | Content += ID
194 |
195 | if Handler is None:
196 | print(Title)
197 | print(Content)
198 |
199 | if Ask:
200 | Choise = input('要發佈嗎? [Y]').lower()
201 | Publish = (Choise == 'y') or (Choise == '')
202 |
203 | if Mail:
204 | for Moderator in Util.Moderators:
205 | PTTBot.mail(Moderator, Title, Content, 0)
206 | PTTBot.log('寄信給 ' + Moderator + ' 成功')
207 | else:
208 | PTTBot.log('取消寄信')
209 |
210 | else:
211 | Handler(CurrentDate, AuthorList, IPList, MaxPost, Min, Sec)
212 |
213 |
214 | HatePoliticsList = dict()
215 |
216 |
217 | def HatePoliticsHandler(CurrentDate, AuthorList, IPList, MaxPost, Min, Sec):
218 |
219 | global new_line
220 | global HatePoliticsList
221 |
222 | MultiPOResult = ''
223 | PublishContent = ''
224 |
225 | CurrentList = dict()
226 | for Suspect, TitleAuthorList in AuthorList.items():
227 |
228 | if len(TitleAuthorList) <= MaxPost:
229 | continue
230 |
231 | if Suspect in HatePoliticsList:
232 | continue
233 |
234 | MultiPOResult = ''
235 |
236 | for Title in TitleAuthorList:
237 | MultiPOResult += CurrentDate + ' ' + \
238 | Suspect + ' □ ' + Title + NewLine
239 |
240 | # print(f'1-> {MultiPOResult} ====')
241 | PublishContent = ''
242 | MultiPOResult = MultiPOResult.strip()
243 | for line in MultiPOResult.split(NewLine):
244 | PublishContent += ' ' + line + NewLine
245 |
246 | # print(f'2-> {PublishContent} ====')
247 |
248 | CurrentList[Suspect] = PublishContent
249 |
250 | for Suspect in CurrentList:
251 | # print(Suspect)
252 | # print(SuspectList[Suspect])
253 |
254 | Sample = f'''
255 | 一、檢舉人ID:CodingMan
256 |
257 | 二、被檢舉人ID:{Suspect}
258 |
259 | 三、違反板規: ※此項請直接複製完整條文貼上,切勿只寫板規編號※
260 |
261 | 第二章 文章分類
262 |
263 | 17.每日發文/回文上限5篇,禁止手動置底相似文章 違者超貼文章刪除
264 |
265 | 四、違規文章代碼與說明:
266 |
267 | '''
268 | Title = f'多篇文章 {Suspect} 政黑板規2-17'
269 | Content = Sample + CurrentList[Suspect]
270 | Content = Content.replace('\r\n', '==NewLine==')
271 | Content = Content.replace('\n', NewLine)
272 | Content = Content.replace('==NewLine==', '\r\n')
273 |
274 | print(Title)
275 | print(Content)
276 | print('=' * 50)
277 |
278 | # global PTTBot
279 |
280 | # PTTBot.post(
281 | # # 'HateP_Picket',
282 | # 'Test',
283 | # Title,
284 | # Content,
285 | # 1,
286 | # 0
287 | # )
288 |
289 | if len(CurrentList) != 0:
290 | HatePoliticsList.update(CurrentList)
291 | CurrentDate = Util.get_date(dayAgo).replace('/', '')
292 | with open(f'HatePoliticsList_{CurrentDate}.txt', 'w', encoding='utf8') as File:
293 | json.dump(HatePoliticsList, File, indent=4, ensure_ascii=False)
294 | else:
295 | print('沒有結果')
296 |
297 |
298 | if __name__ == '__main__':
299 |
300 | from time import strftime
301 |
302 | SearchList = [
303 | # ('Gossiping', ['Bignana', 'XXXXGAY'], 5, None),
304 | # ('Wanted', ['LittleCalf'], 3, None),
305 | # ('give', ['gogin'], 3, None),
306 | ('HatePolitics', ['Neptunium', 'mark2165',
307 | 'kero2377'], 5, HatePoliticsHandler),
308 | ]
309 |
310 | dayAgo = 0
311 |
312 | try:
313 | with open('../Account.txt') as AccountFile:
314 | Account = json.load(AccountFile)
315 | ID = Account['ID']
316 | Password = Account['Password']
317 | except FileNotFoundError:
318 | ID = input('請輸入帳號: ')
319 | Password = getpass.getpass('請輸入密碼: ')
320 |
321 | try:
322 | CurrentDate = Util.get_date(dayAgo).replace('/', '')
323 | with open(f'HatePoliticsList_{CurrentDate}.txt', encoding='utf8') as File:
324 | HatePoliticsList = json.load(File)
325 | except Exception as e:
326 |
327 | traceback.print_tb(e.__traceback__)
328 | print(e)
329 | print('無法讀取 HatePoliticsList.txt')
330 | HatePoliticsList = dict()
331 |
332 | LastDate = Util.get_date(dayAgo)
333 |
334 | ptt_bot = PTT.Library(
335 | # LogLevel=PTT.LogLevel.TRACE
336 | )
337 | try:
338 | ptt_bot.login(
339 | ID,
340 | Password,
341 | KickOtherLogin=True
342 | )
343 | except PTT.Exceptions.LoginError:
344 | ptt_bot.log('登入失敗')
345 | sys.exit()
346 | except PTT.Exceptions.ConnectError:
347 | ptt_bot.log('登入失敗')
348 | sys.exit()
349 | except PTT.Exceptions.ConnectionClosed:
350 | ptt_bot.log('登入失敗')
351 | sys.exit()
352 |
353 | Index = 0
354 | LastIndex = 0
355 | while True:
356 | while LastIndex == Index:
357 | Time = strftime('%H:%M:%S')
358 | try:
359 | CurrentDate = Util.get_date(dayAgo)
360 | if CurrentDate != LastDate:
361 | # 新的一天!!!清空清單
362 | ptt_bot.logout()
363 |
364 | print('半夜休息中')
365 |
366 | # 暫停六小時
367 | time.sleep(60 * 60 * 6)
368 | print('重新上工!!')
369 | LastDate = CurrentDate
370 | HatePoliticsList = dict()
371 |
372 | ptt_bot.login(ID, Password)
373 |
374 | Index = ptt_bot.getNewestIndex(
375 | PTT.IndexType.BBS,
376 | Board='ALLPOST',
377 | SearchType=PTT.PostSearchType.Keyword,
378 | SearchCondition='(HatePolitics)',
379 | )
380 | except PTT.Exceptions.ConnectionClosed:
381 | while True:
382 | try:
383 | ptt_bot.login(
384 | ID,
385 | Password,
386 | KickOtherLogin=True
387 | )
388 | break
389 | except PTT.Exceptions.LoginError:
390 | ptt_bot.log('登入失敗')
391 | time.sleep(1)
392 | except PTT.Exceptions.ConnectError:
393 | ptt_bot.log('登入失敗')
394 | time.sleep(1)
395 | except PTT.Exceptions.ConnectionClosed:
396 | ptt_bot.log('登入失敗')
397 | time.sleep(1)
398 | except PTT.Exceptions.UseTooManyResources:
399 | while True:
400 | try:
401 | ptt_bot.login(
402 | ID,
403 | Password,
404 | KickOtherLogin=True
405 | )
406 | break
407 | except PTT.Exceptions.LoginError:
408 | ptt_bot.log('登入失敗')
409 | time.sleep(1)
410 | except PTT.Exceptions.ConnectError:
411 | ptt_bot.log('登入失敗')
412 | time.sleep(1)
413 | print(f'{Time} 最新編號 {Index}', end='\r')
414 | if LastIndex != Index:
415 | LastIndex = Index
416 | print(f'{Time} 最新編號 {Index}')
417 | break
418 | LastIndex = Index
419 | time.sleep(5)
420 |
421 | for (current_board, ModeratorList, MaxPost, Handler) in SearchList:
422 | MultiPO(current_board, ModeratorList, MaxPost, Handler)
423 |
424 | ptt_bot.logout()
425 |
--------------------------------------------------------------------------------
/multi_post/README.MD:
--------------------------------------------------------------------------------
1 | # 超貼工具
2 | #### 詳見 MultiPO.py
3 |
--------------------------------------------------------------------------------
/multi_thread_crawler/README.MD:
--------------------------------------------------------------------------------
1 | # 多線程 PTT 登入式爬蟲
2 |
3 | account_list.txt
4 | 帳號密碼格式
5 |
6 | ```json
7 | {
8 | "id_0": "pw_0",
9 | "id_1": "pw_1",
10 | "id_2": "pw_2"
11 | }
12 | ```
13 |
14 | 找到 Do anything you want here
15 | 實作你的邏輯
16 |
17 |
--------------------------------------------------------------------------------
/multi_thread_crawler/crawler.py:
--------------------------------------------------------------------------------
1 | import threading
2 | import json
3 | from PyPtt import PTT
4 | import os
5 |
6 |
7 | class Crawler:
8 | def __init__(self, account_file_name, board, start_index, end_index, number_threads: int = 6):
9 | with open(account_file_name) as f:
10 | account = json.load(f)
11 |
12 | if number_threads < 1 or len(account) * 3 < number_threads:
13 | raise ValueError()
14 |
15 | if 0 < number_threads <= len(account):
16 | account_use = 1
17 | else:
18 | account_use = 3
19 |
20 | # print(len(self.account))
21 | # print(account_use)
22 |
23 | # print(start_index)
24 | # print(end_index)
25 |
26 | total_index = end_index - start_index + 1
27 | basic_index = int(total_index / number_threads)
28 | # print(total_index)
29 | # print(basic_index)
30 |
31 | start = start_index
32 | id_count = dict()
33 | id_index = 0
34 |
35 | thread_list = list()
36 |
37 | for thread_index in range(number_threads):
38 | # print('====')
39 | end = start + basic_index - 1
40 | if thread_index < (total_index % number_threads):
41 | end += 1
42 |
43 | if list(account.keys())[id_index] not in id_count:
44 | id_count[list(account.keys())[id_index]] = 0
45 | if id_count[list(account.keys())[id_index]] >= account_use:
46 | id_index += 1
47 | if list(account.keys())[id_index] not in id_count:
48 | id_count[list(account.keys())[id_index]] = 0
49 |
50 | id_count[list(account.keys())[id_index]] += 1
51 |
52 | id = list(account.keys())[id_index]
53 | pw = account[id]
54 |
55 | # print(start, end)
56 |
57 | t = threading.Thread(target=self.crawl_worker, args=(id, pw, board, start, end))
58 | t.start()
59 |
60 | thread_list.append(t)
61 |
62 | start = end + 1
63 |
64 | for t in thread_list:
65 | t.join()
66 |
67 | def crawl_worker(self, id, pw, board, start_index, end_index):
68 | ptt_bot = PTT.API()
69 | ptt_bot.login(id, pw)
70 |
71 | for index in range(start_index, end_index + 1):
72 | try:
73 | post_info = ptt_bot.get_post(board, post_index=index)
74 | except:
75 | print('get_post error', index)
76 | continue
77 | if post_info is None:
78 | continue
79 |
80 | if post_info.date is None:
81 | print('aid', post_info.aid)
82 | print('內文', post_info.content)
83 | print('===========')
84 | continue
85 |
86 | # print(post_info.title)
87 | try:
88 | date = post_info.date.split(' ')
89 | date.pop(0)
90 | date.insert(0, date[-1])
91 | date.pop()
92 | date = [x for x in date if len(x) != 0]
93 | if len(date[2]) == 1:
94 | date[2] = '0' + date[2]
95 | file_name = '_'.join(date).replace(':', '.') + '.json'
96 |
97 | if len(file_name) != 25:
98 | print('aid', post_info.aid)
99 | print('file name error', file_name)
100 | print('date error', post_info.date)
101 | print('===========')
102 |
103 | continue
104 | except:
105 | print('aid', post_info.aid)
106 | print('date error', post_info.date)
107 | print('===========')
108 | continue
109 |
110 | data = dict()
111 | data['aid'] = post_info.aid
112 | data['author'] = post_info.author
113 | data['title'] = post_info.title
114 | data['date'] = post_info.date
115 | data['location'] = post_info.location
116 | data['content'] = post_info.content
117 | data['ip'] = post_info.ip
118 |
119 | push_list = list()
120 | for push in post_info.push_list:
121 | current_push = dict()
122 | current_push['author'] = push.author
123 | current_push['content'] = push.content
124 | current_push['time'] = push.time
125 | push_list.append(current_push)
126 |
127 | data['push_list'] = push_list
128 |
129 | if os.path.isfile(f'LAW/{file_name}'):
130 | continue
131 | with open(f'LAW/{file_name}', 'w', encoding='utf-8') as f:
132 | json.dump(data, f, ensure_ascii=False, indent=4)
133 | # print(file_name)
134 | # Do anything you want here!!!
135 |
136 | ptt_bot.logout()
137 |
138 |
139 | if __name__ == '__main__':
140 | board = 'LAW'
141 | end_index = 32598
142 |
143 | start_index = 1
144 |
145 | import time
146 |
147 | start_time = time.time()
148 | Crawler('account_list.txt', board, start_index, end_index)
149 | end_time = time.time()
150 |
151 | total_time = int(end_time - start_time)
152 |
153 | print(f'爬行 {board} 共耗費時間 %.2f 秒' % total_time)
154 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | PyPtt
--------------------------------------------------------------------------------
/wait_register.py:
--------------------------------------------------------------------------------
1 | import json
2 | import sys
3 | import traceback
4 | import time
5 | import datetime
6 | from PyPtt import PTT
7 |
8 |
9 | def get_password(password_file):
10 | try:
11 | with open(password_file) as AccountFile:
12 | account = json.load(AccountFile)
13 | ptt_id = account['ID']
14 | password = account['Password']
15 | except FileNotFoundError:
16 | print(f'Please note PTT ID and Password in {password_file}')
17 | print('{"ID":"YourID", "Password":"YourPassword"}')
18 | sys.exit()
19 |
20 | return ptt_id, password
21 |
22 |
23 | ptt_id, password = get_password('Account.txt')
24 | while True:
25 | try:
26 | ptt_bot = PTT.API()
27 | try:
28 | ptt_bot.login(
29 | ptt_id,
30 | password,
31 | # kick_other_login=True
32 | )
33 | except PTT.exceptions.LoginError:
34 | ptt_bot.log('登入失敗')
35 | sys.exit()
36 | except PTT.exceptions.WrongIDorPassword:
37 | ptt_bot.log('帳號密碼錯誤')
38 | sys.exit()
39 | except PTT.exceptions.LoginTooOften:
40 | ptt_bot.log('請稍等一下再登入')
41 | sys.exit()
42 |
43 | if ptt_bot.unregistered_user:
44 | print('未註冊使用者')
45 |
46 | process_picks = -1
47 | if ptt_bot.process_picks != 0:
48 | process_picks = ptt_bot.process_picks
49 | print(f'註冊單處理順位 {ptt_bot.process_picks}')
50 |
51 | if process_picks == -1:
52 | ptt_bot.logout()
53 | continue
54 |
55 | if ptt_bot.registered_user:
56 | print('已註冊使用者!!!!!!!!!!!!!!!!!!')
57 |
58 | ptt2_bot = PTT.API(
59 | host=PTT.data_type.host_type.PTT2)
60 | try:
61 | ptt2_bot.login(
62 | ptt_id,
63 | password)
64 | except PTT.exceptions.LoginError:
65 | ptt_bot.log('登入失敗')
66 | sys.exit()
67 | except PTT.exceptions.WrongIDorPassword:
68 | ptt_bot.log('帳號密碼錯誤')
69 | sys.exit()
70 | except PTT.exceptions.LoginTooOften:
71 | ptt_bot.log('請稍等一下再登入')
72 | sys.exit()
73 |
74 | if ptt_bot.registered_user:
75 | content = '註冊通過!!!!!!!!!!!!!!!!!'
76 | else:
77 | date = time.strftime("%m/%d", time.localtime())
78 |
79 | start_date = datetime.datetime(
80 | 2020,
81 | 6,
82 | 20)
83 |
84 | today = datetime.datetime.today()
85 |
86 | delta = today - start_date
87 | delta_day = delta.days
88 |
89 | delta_pick = 8984 - process_picks
90 |
91 | print('process_picks', process_picks)
92 | print('delta_pick', delta_pick)
93 | print('delta_day', delta_day)
94 |
95 | if delta_pick != 0:
96 | avg_day_delta = (delta_pick / delta_day)
97 |
98 | # print(f'平均每天消耗 {avg_day_delta}')
99 |
100 | need_day = int(process_picks / avg_day_delta)
101 | content = f'{date} {process_picks} 預估尚須等待 {need_day} 天'
102 | else:
103 | content = f'今天為計算起始日無法計算,請明天重新執行'
104 |
105 | print(content)
106 |
107 | ptt2_bot.push('CodingMan', PTT.data_type.push_type.ARROW, content, post_aid='1UxO3FTe')
108 |
109 | except Exception as e:
110 | traceback.print_tb(e.__traceback__)
111 | print(e)
112 | except KeyboardInterrupt:
113 | pass
114 |
115 | ptt_bot.logout()
116 | ptt2_bot.logout()
117 | break
118 |
--------------------------------------------------------------------------------
|