new.py 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944
  1. import asyncio
  2. import aiohttp
  3. import re
  4. import datetime
  5. import requests
  6. import eventlet
  7. import os
  8. import time
  9. import threading
  10. from queue import Queue
  11. eventlet.monkey_patch()
  12. urls = [
  13. "http://1.192.12.1:9901",
  14. "http://1.192.248.1:9901",
  15. "http://1.194.52.1:10086",
  16. "http://1.195.111.1:11190",
  17. "http://1.195.130.1:9901",
  18. "http://1.195.131.1:9901",
  19. "http://1.195.62.1:9901",
  20. "http://1.196.192.1:9901",
  21. "http://1.196.252.1:9901",
  22. "http://1.196.55.1:9901",
  23. "http://1.197.153.1:9901",
  24. "http://1.197.203.1:9901",
  25. "http://1.197.249.1:9901",
  26. "http://1.197.250.1:9901",
  27. "http://1.197.251.1:9901",
  28. "http://1.197.82.1:9901",
  29. "http://1.197.83.1:9901",
  30. "http://1.197.84.1:9901",
  31. "http://1.198.30.1:9901",
  32. "http://1.198.67.1:9901",
  33. "http://1.199.234.1:9901",
  34. "http://1.199.235.1:9901",
  35. "http://101.65.32.1:9901",
  36. "http://101.65.34.1:9901",
  37. "http://101.66.194.1:9901",
  38. "http://101.66.195.1:9901",
  39. "http://101.66.198.1:9901",
  40. "http://101.66.199.1:9901",
  41. "http://101.71.213.1:9901",
  42. "http://101.72.127.1:808",
  43. "http://101.74.28.1:9901",
  44. "http://103.39.222.1:9999",
  45. "http://106.115.121.1:9901",
  46. "http://106.118.70.1:9901",
  47. "http://106.124.91.1:9901",
  48. "http://106.46.114.1:8011",
  49. "http://106.46.147.1:10443",
  50. "http://106.46.34.1:9901",
  51. "http://106.55.164.1:9901",
  52. "http://110.189.180.1:9901",
  53. "http://110.52.99.1:9901",
  54. "http://110.53.218.1:9902",
  55. "http://110.7.128.1:8096",
  56. "http://110.7.129.1:8096",
  57. "http://110.7.130.1:8096",
  58. "http://110.72.53.1:8181",
  59. "http://110.81.206.1:50080",
  60. "http://111.15.174.1:8969",
  61. "http://111.225.112.1:808",
  62. "http://111.225.114.1:808",
  63. "http://111.225.115.1:9901",
  64. "http://111.33.89.1:9901",
  65. "http://111.59.63.1:9901",
  66. "http://111.74.155.1:9901",
  67. "http://111.78.22.1:9901",
  68. "http://111.78.34.1:9901",
  69. "http://111.8.224.1:8085",
  70. "http://111.8.242.1:8085",
  71. "http://111.8.242.1:9901",
  72. "http://111.8.242.1:9999",
  73. "http://111.9.163.1:9901",
  74. "http://112.101.78.1:9901",
  75. "http://112.116.14.1:9901",
  76. "http://112.116.15.1:9901",
  77. "http://112.123.130.1:9901",
  78. "http://112.123.138.1:9901",
  79. "http://112.123.217.1:9901",
  80. "http://112.123.218.1:9901",
  81. "http://112.123.219.1:9901",
  82. "http://112.132.160.1:9901",
  83. "http://112.193.114.1:9901",
  84. "http://112.193.42.1:9901",
  85. "http://112.194.128.1:9901",
  86. "http://112.194.140.1:9901",
  87. "http://112.194.206.1:9901",
  88. "http://112.234.21.1:9901",
  89. "http://112.234.23.1:9901",
  90. "http://112.235.200.1:9901",
  91. "http://112.235.201.1:9901",
  92. "http://112.235.202.1:9901",
  93. "http://112.26.18.1:9901",
  94. "http://112.27.145.1:9901",
  95. "http://112.5.146.1:9900",
  96. "http://112.5.89.1:9900",
  97. "http://112.5.89.1:9901",
  98. "http://112.6.117.1:9901",
  99. "http://112.6.126.1:9901",
  100. "http://112.6.165.1:9901",
  101. "http://112.6.178.1:9901",
  102. "http://112.91.103.1:9919",
  103. "http://112.99.193.1:9901",
  104. "http://112.99.195.1:9901",
  105. "http://112.99.200.1:9901",
  106. "http://113.100.72.1:9901",
  107. "http://113.111.104.1:9901",
  108. "http://113.116.145.1:8883",
  109. "http://113.116.56.1:8883",
  110. "http://113.116.58.1:8883",
  111. "http://113.116.59.1:8883",
  112. "http://113.124.234.1:9901",
  113. "http://113.124.72.1:9901",
  114. "http://113.15.186.1:8181",
  115. "http://113.195.13.1:9901",
  116. "http://113.195.162.1:9901",
  117. "http://113.195.4.1:9901",
  118. "http://113.195.45.1:9901",
  119. "http://113.195.7.1:9901",
  120. "http://113.195.8.1:9901",
  121. "http://113.200.214.1:9902",
  122. "http://113.201.61.1:9901",
  123. "http://113.205.195.1:9901",
  124. "http://113.205.196.1:9901",
  125. "http://113.206.102.1:9901",
  126. "http://113.218.188.1:9901",
  127. "http://113.218.189.1:8081",
  128. "http://113.218.190.1:8081",
  129. "http://113.218.204.1:8081",
  130. "http://113.220.232.1:9999",
  131. "http://113.220.233.1:9999",
  132. "http://113.220.234.1:9999",
  133. "http://113.220.235.1:9999",
  134. "http://113.223.12.1:9998",
  135. "http://113.236.30.1:9901",
  136. "http://113.245.217.1:9901",
  137. "http://113.245.218.1:9901",
  138. "http://113.245.219.1:9901",
  139. "http://113.57.20.1:9901",
  140. "http://113.57.93.1:9900",
  141. "http://113.64.94.1:9901",
  142. "http://113.70.161.1:9901",
  143. "http://113.81.21.1:9901",
  144. "http://113.92.198.1:8883",
  145. "http://114.254.92.1:88",
  146. "http://115.149.139.1:10001",
  147. "http://115.207.18.1:9901",
  148. "http://115.207.211.1:9901",
  149. "http://115.207.24.1:9901",
  150. "http://115.215.143.1:9901",
  151. "http://115.220.17.1:9901",
  152. "http://115.224.206.1:9901",
  153. "http://115.225.233.1:9901",
  154. "http://115.236.171.1:9901",
  155. "http://115.236.83.1:1111",
  156. "http://115.48.160.1:9901",
  157. "http://115.48.161.1:9901",
  158. "http://115.48.22.1:9901",
  159. "http://115.48.60.1:9901",
  160. "http://115.48.62.1:9901",
  161. "http://115.48.63.1:9901",
  162. "http://115.50.120.1:9901",
  163. "http://115.55.132.1:9901",
  164. "http://115.55.59.1:9901",
  165. "http://115.59.9.1:9901",
  166. "http://116.117.104.1:8096",
  167. "http://116.117.105.1:8096",
  168. "http://116.117.106.1:8096",
  169. "http://116.117.107.1:8096",
  170. "http://116.128.224.1:9901",
  171. "http://116.128.242.1:9901",
  172. "http://116.167.111.1:9901",
  173. "http://116.167.76.1:9901",
  174. "http://116.167.79.1:9901",
  175. "http://116.227.232.1:7777",
  176. "http://116.233.34.1:7777",
  177. "http://116.30.121.1:8883",
  178. "http://116.31.165.1:280",
  179. "http://116.31.165.1:3079",
  180. "http://116.31.165.1:6666",
  181. "http://116.55.141.1:9901",
  182. "http://116.55.176.1:9901",
  183. "http://116.55.180.1:9901",
  184. "http://117.174.99.1:9901",
  185. "http://117.27.190.1:9901",
  186. "http://117.27.190.1:9998",
  187. "http://117.90.196.1:6000",
  188. "http://118.122.189.1:9901",
  189. "http://118.248.167.1:8088",
  190. "http://118.248.168.1:8088",
  191. "http://118.248.169.1:8088",
  192. "http://118.248.170.1:8088",
  193. "http://118.248.216.1:8088",
  194. "http://118.253.0.1:2023",
  195. "http://118.72.48.1:888",
  196. "http://118.72.49.1:888",
  197. "http://118.72.50.1:888",
  198. "http://118.72.51.1:888",
  199. "http://118.72.68.1:888",
  200. "http://118.72.69.1:888",
  201. "http://118.81.106.1:9999",
  202. "http://118.81.107.1:9999",
  203. "http://119.119.77.1:9901",
  204. "http://119.120.196.1:9999",
  205. "http://119.125.104.1:9901",
  206. "http://119.125.128.1:9901",
  207. "http://119.125.129.1:9901",
  208. "http://119.125.130.1:9901",
  209. "http://119.125.131.1:9901",
  210. "http://119.125.134.1:7788",
  211. "http://119.125.134.1:9901",
  212. "http://119.129.173.1:9999",
  213. "http://119.142.76.1:9901",
  214. "http://119.142.77.1:9901",
  215. "http://119.163.199.1:9901",
  216. "http://119.163.228.1:9901",
  217. "http://119.163.56.1:9901",
  218. "http://119.163.57.1:9901",
  219. "http://119.163.60.1:9901",
  220. "http://119.163.61.1:9901",
  221. "http://119.163.63.1:9901",
  222. "http://119.164.81.1:9901",
  223. "http://119.177.21.1:9901",
  224. "http://119.177.23.1:9901",
  225. "http://119.179.182.1:9901",
  226. "http://119.183.200.1:9901",
  227. "http://119.39.192.1:9898",
  228. "http://119.51.52.1:9901",
  229. "http://119.51.62.1:9901",
  230. "http://119.51.63.1:9901",
  231. "http://119.51.64.1:9901",
  232. "http://119.62.28.1:9901",
  233. "http://119.62.36.1:9901",
  234. "http://119.62.80.1:9901",
  235. "http://120.0.52.1:8086",
  236. "http://120.0.8.1:8086",
  237. "http://120.197.43.1:9901",
  238. "http://120.198.96.1:9901",
  239. "http://120.198.99.1:9901",
  240. "http://120.211.129.1:9901",
  241. "http://120.224.178.1:9901",
  242. "http://120.224.23.1:9901",
  243. "http://120.238.150.1:9901",
  244. "http://120.238.85.1:9901",
  245. "http://121.19.134.1:808",
  246. "http://121.232.178.1:5000",
  247. "http://121.232.187.1:6000",
  248. "http://121.238.176.1:9901",
  249. "http://121.24.98.1:9901",
  250. "http://121.33.239.1:9901",
  251. "http://121.43.180.1:9901",
  252. "http://121.62.63.1:9901",
  253. "http://122.114.171.1:9901",
  254. "http://122.114.192.1:9901",
  255. "http://122.138.32.1:9999",
  256. "http://122.139.47.1:9901",
  257. "http://122.188.62.1:8800",
  258. "http://122.227.100.1:9901",
  259. "http://122.230.62.1:9901",
  260. "http://122.246.75.1:9901",
  261. "http://122.4.92.1:9991",
  262. "http://123.10.69.1:9901",
  263. "http://123.10.70.1:9901",
  264. "http://123.10.71.1:9901",
  265. "http://123.101.144.1:9901",
  266. "http://123.101.98.1:9898",
  267. "http://123.12.148.1:9901",
  268. "http://123.129.70.1:9901",
  269. "http://123.13.28.1:9901",
  270. "http://123.13.29.1:9901",
  271. "http://123.13.57.1:9901",
  272. "http://123.13.60.1:9901",
  273. "http://123.13.80.1:9901",
  274. "http://123.13.83.1:9901",
  275. "http://123.130.84.1:8154",
  276. "http://123.131.200.1:9901",
  277. "http://123.132.234.1:8154",
  278. "http://123.138.216.1:9902",
  279. "http://123.138.22.1:9901",
  280. "http://123.139.57.1:9901",
  281. "http://123.149.160.1:9901",
  282. "http://123.149.163.1:9901",
  283. "http://123.154.154.1:9901",
  284. "http://123.154.155.1:9901",
  285. "http://123.154.157.1:9901",
  286. "http://123.154.252.1:9901",
  287. "http://123.154.253.1:9901",
  288. "http://123.159.128.1:9901",
  289. "http://123.159.135.1:9901",
  290. "http://123.161.132.1:9901",
  291. "http://123.161.37.1:9901",
  292. "http://123.163.114.1:85",
  293. "http://123.163.114.1:9901",
  294. "http://123.163.21.1:9901",
  295. "http://123.163.55.1:9901",
  296. "http://123.163.94.1:9901",
  297. "http://123.182.209.1:8088",
  298. "http://123.182.211.1:8088",
  299. "http://123.182.212.1:9901",
  300. "http://123.182.247.1:4433",
  301. "http://123.183.24.1:6666",
  302. "http://123.183.25.1:6666",
  303. "http://123.183.27.1:6666",
  304. "http://123.189.36.1:9901",
  305. "http://123.235.8.1:9901",
  306. "http://123.4.125.1:9901",
  307. "http://123.52.12.1:9901",
  308. "http://123.54.171.1:9901",
  309. "http://123.54.220.1:9901",
  310. "http://123.55.3.1:9901",
  311. "http://123.7.110.1:9901",
  312. "http://123.9.47.1:9901",
  313. "http://124.126.4.1:9901",
  314. "http://124.128.73.1:9901",
  315. "http://124.129.235.1:9901",
  316. "http://124.152.247.1:2001",
  317. "http://124.228.160.1:9901",
  318. "http://124.229.231.1:9901",
  319. "http://124.231.212.1:9999",
  320. "http://124.231.213.1:9999",
  321. "http://124.231.214.1:9999",
  322. "http://124.234.179.1:9901",
  323. "http://124.234.199.1:9901",
  324. "http://124.238.110.1:9999",
  325. "http://124.66.82.1:9901",
  326. "http://124.90.211.1:9901",
  327. "http://124.94.193.1:9902",
  328. "http://125.106.86.1:9901",
  329. "http://125.107.177.1:9901",
  330. "http://125.107.97.1:9901",
  331. "http://125.114.210.1:9901",
  332. "http://125.114.241.1:9901",
  333. "http://125.115.210.1:9901",
  334. "http://125.119.48.1:9901",
  335. "http://125.125.129.1:9901",
  336. "http://125.125.133.1:9901",
  337. "http://125.125.134.1:9901",
  338. "http://125.125.225.1:9901",
  339. "http://125.125.233.1:9901",
  340. "http://125.125.234.1:9901",
  341. "http://125.125.236.1:9901",
  342. "http://125.32.120.1:9901",
  343. "http://125.42.148.1:9901",
  344. "http://125.42.150.1:9901",
  345. "http://125.42.151.1:9901",
  346. "http://125.43.240.1:9901",
  347. "http://125.43.244.1:9901",
  348. "http://125.43.247.1:9901",
  349. "http://125.43.249.1:9901",
  350. "http://125.71.73.1:9901",
  351. "http://125.93.74.1:9002",
  352. "http://139.209.36.1:9901",
  353. "http://139.209.39.1:9901",
  354. "http://14.106.236.1:9901",
  355. "http://14.106.239.1:9901",
  356. "http://14.204.108.1:9901",
  357. "http://14.204.109.1:9901",
  358. "http://14.204.29.1:9901",
  359. "http://14.204.46.1:9901",
  360. "http://14.204.53.1:9901",
  361. "http://14.212.185.1:9901",
  362. "http://14.216.204.1:8883",
  363. "http://14.216.215.1:8883",
  364. "http://14.216.218.1:8883",
  365. "http://14.216.220.1:8883",
  366. "http://14.216.221.1:8883",
  367. "http://14.216.227.1:8883",
  368. "http://14.29.76.1:9901",
  369. "http://144.52.160.1:9901",
  370. "http://144.52.162.1:9901",
  371. "http://150.255.145.1:9901",
  372. "http://150.255.149.1:9901",
  373. "http://150.255.150.1:9901",
  374. "http://150.255.157.1:9901",
  375. "http://150.255.216.1:9901",
  376. "http://153.0.204.1:9901",
  377. "http://163.177.122.1:9901",
  378. "http://171.104.198.1:8181",
  379. "http://171.106.217.1:8181",
  380. "http://171.108.239.1:8181",
  381. "http://171.109.208.1:8099",
  382. "http://171.109.6.1:8181",
  383. "http://171.12.164.1:9901",
  384. "http://171.12.189.1:9901",
  385. "http://171.14.89.1:9901",
  386. "http://171.35.124.1:10011",
  387. "http://171.38.194.1:8082",
  388. "http://171.8.75.1:8011",
  389. "http://175.0.32.1:8081",
  390. "http://175.0.35.1:8081",
  391. "http://175.16.149.1:9901",
  392. "http://175.16.151.1:9901",
  393. "http://175.16.153.1:9901",
  394. "http://175.16.155.1:9901",
  395. "http://175.16.184.1:9901",
  396. "http://175.16.198.1:9901",
  397. "http://175.16.250.1:9901",
  398. "http://175.18.189.1:9902",
  399. "http://175.8.87.1:9998",
  400. "http://180.113.102.1:5000",
  401. "http://180.117.149.1:9901",
  402. "http://180.124.146.1:60000",
  403. "http://180.175.163.1:7777",
  404. "http://180.213.174.1:9901",
  405. "http://182.112.188.1:9901",
  406. "http://182.112.28.1:9901",
  407. "http://182.113.201.1:9901",
  408. "http://182.113.206.1:9901",
  409. "http://182.113.6.1:9901",
  410. "http://182.114.185.1:9901",
  411. "http://182.114.212.1:9901",
  412. "http://182.114.214.1:9901",
  413. "http://182.114.215.1:9901",
  414. "http://182.114.48.1:9901",
  415. "http://182.114.49.1:9901",
  416. "http://182.114.50.1:9901",
  417. "http://182.117.136.1:9901",
  418. "http://182.117.90.1:9901",
  419. "http://182.120.229.1:9901",
  420. "http://182.122.122.1:9901",
  421. "http://182.122.73.1:10086",
  422. "http://182.125.172.1:9901",
  423. "http://182.126.114.1:9901",
  424. "http://182.126.115.1:9901",
  425. "http://182.126.119.1:9901",
  426. "http://182.150.25.1:9901",
  427. "http://182.241.192.1:9901",
  428. "http://182.241.193.1:9901",
  429. "http://182.241.194.1:9901",
  430. "http://182.34.67.1:9901",
  431. "http://182.46.196.1:9901",
  432. "http://183.0.186.1:8888",
  433. "http://183.0.186.1:9900",
  434. "http://183.10.180.1:9901",
  435. "http://183.10.181.1:9901",
  436. "http://183.131.246.1:9901",
  437. "http://183.136.148.1:9901",
  438. "http://183.203.147.1:9901",
  439. "http://183.203.151.1:9901",
  440. "http://183.238.113.1:8883",
  441. "http://183.239.226.1:9901",
  442. "http://183.24.48.1:9901",
  443. "http://183.255.41.1:9901",
  444. "http://183.63.15.1:9901",
  445. "http://183.94.146.1:2222",
  446. "http://202.100.46.1:9901",
  447. "http://202.168.187.1:2024",
  448. "http://202.168.187.1:9999",
  449. "http://210.22.75.1:9901",
  450. "http://211.142.224.1:2023",
  451. "http://218.13.170.1:9901",
  452. "http://218.29.147.1:9901",
  453. "http://218.71.245.1:9901",
  454. "http://218.74.169.1:9901",
  455. "http://218.74.171.1:9901",
  456. "http://218.75.241.1:9901",
  457. "http://218.76.32.1:9901",
  458. "http://218.77.81.1:9901",
  459. "http://218.87.237.1:9901",
  460. "http://219.137.202.1:9999",
  461. "http://219.146.83.1:9902",
  462. "http://219.146.90.1:9901",
  463. "http://219.154.240.1:9901",
  464. "http://219.154.241.1:9901",
  465. "http://219.154.242.1:9901",
  466. "http://219.154.243.1:9901",
  467. "http://219.156.143.1:9901",
  468. "http://219.159.194.1:8181",
  469. "http://220.161.206.1:9901",
  470. "http://220.163.178.1:8888",
  471. "http://220.164.192.1:50085",
  472. "http://220.179.68.1:9901",
  473. "http://220.180.109.1:9901",
  474. "http://220.180.109.1:9902",
  475. "http://220.180.112.1:9901",
  476. "http://220.180.229.1:9901",
  477. "http://220.202.98.1:14901",
  478. "http://220.248.173.1:9901",
  479. "http://220.248.188.1:8991",
  480. "http://220.249.114.1:9901",
  481. "http://221.13.235.1:9901",
  482. "http://221.14.152.1:9901",
  483. "http://221.14.153.1:9901",
  484. "http://221.14.155.1:9901",
  485. "http://221.14.156.1:9901",
  486. "http://221.14.158.1:9901",
  487. "http://221.14.159.1:9901",
  488. "http://221.193.168.1:9901",
  489. "http://221.2.148.1:8154",
  490. "http://221.205.128.1:9999",
  491. "http://221.205.129.1:9999",
  492. "http://221.205.130.1:9999",
  493. "http://221.205.131.1:9999",
  494. "http://221.206.104.1:9901",
  495. "http://221.213.69.1:9901",
  496. "http://221.213.94.1:9901",
  497. "http://221.224.4.1:1111",
  498. "http://221.224.72.1:9901",
  499. "http://221.225.236.1:9901",
  500. "http://221.226.4.1:9901",
  501. "http://221.226.8.1:9527",
  502. "http://221.233.192.1:1111",
  503. "http://221.7.239.1:8181",
  504. "http://221.9.97.1:9901",
  505. "http://222.134.245.1:9901",
  506. "http://222.136.68.1:9901",
  507. "http://222.138.109.1:9901",
  508. "http://222.140.9.1:9901",
  509. "http://222.142.198.1:9901",
  510. "http://222.142.72.1:9901",
  511. "http://222.142.73.1:9901",
  512. "http://222.142.93.1:9901",
  513. "http://222.169.70.1:9901",
  514. "http://222.173.134.1:8888",
  515. "http://222.174.140.1:9901",
  516. "http://222.175.199.1:9901",
  517. "http://222.185.245.1:9901",
  518. "http://222.190.173.1:9901",
  519. "http://222.218.158.1:8181",
  520. "http://222.240.60.1:9901",
  521. "http://222.241.154.1:9901",
  522. "http://222.243.221.1:9901",
  523. "http://222.243.24.1:9901",
  524. "http://222.84.192.1:8181",
  525. "http://222.84.193.1:8181",
  526. "http://222.89.19.1:9901",
  527. "http://222.89.210.1:9901",
  528. "http://222.92.7.1:3333",
  529. "http://222.92.7.1:3334",
  530. "http://223.151.51.1:9901",
  531. "http://223.159.11.1:8099",
  532. "http://223.159.8.1:8099",
  533. "http://223.159.9.1:8099",
  534. "http://223.166.234.1:7777",
  535. "http://223.199.83.1:9901",
  536. "http://223.241.247.1:9901",
  537. "http://223.243.10.1:9008",
  538. "http://223.243.2.1:9008",
  539. "http://223.68.201.1:9901",
  540. "http://223.75.123.1:9901",
  541. "http://223.75.148.1:9901",
  542. "http://27.14.163.1:9901",
  543. "http://27.14.84.1:9901",
  544. "http://27.188.213.1:9901",
  545. "http://27.188.9.1:9901",
  546. "http://27.192.126.1:9901",
  547. "http://27.203.143.1:9901",
  548. "http://27.223.98.1:9901",
  549. "http://27.36.116.1:9901",
  550. "http://27.8.192.1:9901",
  551. "http://27.8.233.1:9901",
  552. "http://27.8.243.1:9901",
  553. "http://36.134.209.1:9901",
  554. "http://36.136.77.1:9901",
  555. "http://36.249.150.1:9901",
  556. "http://36.249.151.1:9901",
  557. "http://36.34.58.1:9901",
  558. "http://36.35.220.1:9901",
  559. "http://36.35.223.1:9901",
  560. "http://36.40.236.1:9999",
  561. "http://36.44.157.1:9901",
  562. "http://36.44.159.1:9901",
  563. "http://36.49.56.1:9901",
  564. "http://36.99.134.1:9901",
  565. "http://36.99.206.1:9901",
  566. "http://39.152.171.1:9901",
  567. "http://39.164.202.1:8899",
  568. "http://39.164.222.1:888",
  569. "http://39.165.44.1:9901",
  570. "http://39.74.142.1:9999",
  571. "http://42.225.203.1:9901",
  572. "http://42.225.222.1:9901",
  573. "http://42.235.4.1:9901",
  574. "http://42.237.248.1:9901",
  575. "http://42.237.26.1:9901",
  576. "http://42.238.233.1:9901",
  577. "http://42.238.237.1:9901",
  578. "http://42.48.50.1:9002",
  579. "http://42.49.148.1:9901",
  580. "http://42.49.189.1:9008",
  581. "http://42.5.185.1:9901",
  582. "http://42.5.86.1:9901",
  583. "http://47.104.163.1:9901",
  584. "http://47.116.70.1:9901",
  585. "http://47.122.26.1:9901",
  586. "http://49.232.48.1:9901",
  587. "http://49.234.31.1:7004",
  588. "http://58.17.116.1:9908",
  589. "http://58.19.133.1:9901",
  590. "http://58.19.244.1:1111",
  591. "http://58.20.77.1:9002",
  592. "http://58.209.101.1:9901",
  593. "http://58.210.23.1:9901",
  594. "http://58.210.60.1:9901",
  595. "http://58.216.229.1:9901",
  596. "http://58.218.184.1:9901",
  597. "http://58.220.219.1:1099",
  598. "http://58.220.219.1:9901",
  599. "http://58.23.26.1:9901",
  600. "http://58.23.27.1:9901",
  601. "http://58.242.103.1:9901",
  602. "http://58.243.224.1:9901",
  603. "http://58.243.234.1:9901",
  604. "http://58.243.33.1:9901",
  605. "http://58.243.93.1:9901",
  606. "http://58.245.97.1:9901",
  607. "http://58.245.99.1:9901",
  608. "http://58.48.37.1:1111",
  609. "http://58.48.5.1:1111",
  610. "http://58.51.111.1:1111",
  611. "http://58.51.111.1:9901",
  612. "http://58.53.152.1:9901",
  613. "http://58.53.153.1:9901",
  614. "http://58.53.154.1:9901",
  615. "http://58.53.155.1:9901",
  616. "http://58.57.155.1:9901",
  617. "http://58.57.21.1:9901",
  618. "http://58.57.40.1:9901",
  619. "http://59.173.183.1:9901",
  620. "http://59.173.243.1:9901",
  621. "http://59.32.97.1:9901",
  622. "http://59.44.10.1:9901",
  623. "http://59.44.203.1:9901",
  624. "http://59.49.186.1:9901",
  625. "http://59.49.187.1:9901",
  626. "http://59.49.191.1:9901",
  627. "http://59.50.106.1:9901",
  628. "http://59.62.8.1:9901",
  629. "http://59.63.22.1:8888",
  630. "http://60.12.183.1:9901",
  631. "http://60.167.15.1:9901",
  632. "http://60.169.254.1:9901",
  633. "http://60.172.59.1:9901",
  634. "http://60.174.40.1:9901",
  635. "http://60.174.86.1:9901",
  636. "http://60.185.9.1:9",
  637. "http://60.187.74.1:9901",
  638. "http://60.190.18.1:9901",
  639. "http://60.209.232.1:9901",
  640. "http://60.213.92.1:9901",
  641. "http://60.217.73.1:83",
  642. "http://60.255.137.1:9901",
  643. "http://60.255.47.1:8801",
  644. "http://60.255.47.1:9901",
  645. "http://60.4.9.1:9901",
  646. "http://61.130.72.1:8888",
  647. "http://61.136.172.1:9901",
  648. "http://61.136.67.1:50085",
  649. "http://61.138.128.1:19901",
  650. "http://61.141.114.1:8883",
  651. "http://61.143.43.1:3333",
  652. "http://61.153.215.1:9901",
  653. "http://61.156.228.1:8154",
  654. "http://61.163.181.1:9901",
  655. "http://61.173.144.1:9901",
  656. "http://61.175.237.1:1111",
  657. "http://61.175.237.1:9901",
  658. "http://61.184.128.1:1111",
  659. "http://61.184.128.1:9901",
  660. "http://61.53.90.1:9901",
  661. "http://61.54.14.1:9901"
  662. ]
  663. async def modify_urls(url):
  664. modified_urls = []
  665. ip_start_index = url.find("//") + 2
  666. ip_end_index = url.find(":", ip_start_index)
  667. base_url = url[:ip_start_index]
  668. ip_address = url[ip_start_index:ip_end_index]
  669. port = url[ip_end_index:]
  670. ip_end = "/iptv/live/1000.json?key=txiptv"
  671. for i in range(1, 256):
  672. modified_ip = f"{ip_address[:-1]}{i}"
  673. modified_url = f"{base_url}{modified_ip}{port}{ip_end}"
  674. modified_urls.append(modified_url)
  675. return modified_urls
  676. async def is_url_accessible(session, url, semaphore):
  677. async with semaphore:
  678. try:
  679. async with session.get(url, timeout=0.5) as response:
  680. if response.status == 200:
  681. current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
  682. print(f"{current_time} {url}")
  683. return url
  684. except (aiohttp.ClientError, asyncio.TimeoutError):
  685. pass
  686. return None
  687. async def check_urls(session, urls, semaphore):
  688. tasks = []
  689. for url in urls:
  690. url = url.strip()
  691. modified_urls = await modify_urls(url)
  692. for modified_url in modified_urls:
  693. task = asyncio.create_task(is_url_accessible(session, modified_url, semaphore))
  694. tasks.append(task)
  695. results = await asyncio.gather(*tasks)
  696. valid_urls = [result for result in results if result]
  697. return valid_urls
  698. async def fetch_json(session, url, semaphore):
  699. async with semaphore:
  700. try:
  701. ip_start_index = url.find("//") + 2
  702. ip_dot_start = url.find(".") + 1
  703. ip_index_second = url.find("/", ip_dot_start)
  704. base_url = url[:ip_start_index]
  705. ip_address = url[ip_start_index:ip_index_second]
  706. url_x = f"{base_url}{ip_address}"
  707. json_url = f"{url}"
  708. async with session.get(json_url, timeout=0.5) as response:
  709. json_data = await response.json()
  710. results = []
  711. try:
  712. for item in json_data['data']:
  713. if isinstance(item, dict):
  714. name = item.get('name')
  715. urlx = item.get('url')
  716. if ',' in urlx:
  717. urlx = "aaaaaaaa"
  718. if 'http' in urlx:
  719. urld = f"{urlx}"
  720. else:
  721. urld = f"{url_x}{urlx}"
  722. if name and urlx:
  723. name = name.replace("cctv", "CCTV")
  724. name = name.replace("中央", "CCTV")
  725. name = name.replace("央视", "CCTV")
  726. name = name.replace("高清", "")
  727. name = name.replace("超高", "")
  728. name = name.replace("HD", "")
  729. name = name.replace("标清", "")
  730. name = name.replace("频道", "")
  731. name = name.replace("-", "")
  732. name = name.replace(" ", "")
  733. name = name.replace("PLUS", "+")
  734. name = name.replace("+", "+")
  735. name = name.replace("(", "")
  736. name = name.replace(")", "")
  737. name = re.sub(r"CCTV(\d+)台", r"CCTV\1", name)
  738. name = name.replace("CCTV1综合", "CCTV1")
  739. name = name.replace("CCTV2财经", "CCTV2")
  740. name = name.replace("CCTV3综艺", "CCTV3")
  741. name = name.replace("CCTV4国际", "CCTV4")
  742. name = name.replace("CCTV4中文国际", "CCTV4")
  743. name = name.replace("CCTV4欧洲", "CCTV4")
  744. name = name.replace("CCTV5体育", "CCTV5")
  745. name = name.replace("CCTV6电影", "CCTV6")
  746. name = name.replace("CCTV7军事", "CCTV7")
  747. name = name.replace("CCTV7军农", "CCTV7")
  748. name = name.replace("CCTV7农业", "CCTV7")
  749. name = name.replace("CCTV7国防军事", "CCTV7")
  750. name = name.replace("CCTV8电视剧", "CCTV8")
  751. name = name.replace("CCTV9记录", "CCTV9")
  752. name = name.replace("CCTV9纪录", "CCTV9")
  753. name = name.replace("CCTV10科教", "CCTV10")
  754. name = name.replace("CCTV11戏曲", "CCTV11")
  755. name = name.replace("CCTV12社会与法", "CCTV12")
  756. name = name.replace("CCTV13新闻", "CCTV13")
  757. name = name.replace("CCTV新闻", "CCTV13")
  758. name = name.replace("CCTV14少儿", "CCTV14")
  759. name = name.replace("CCTV15音乐", "CCTV15")
  760. name = name.replace("CCTV16奥林匹克", "CCTV16")
  761. name = name.replace("CCTV17农业农村", "CCTV17")
  762. name = name.replace("CCTV17农业", "CCTV17")
  763. name = name.replace("CCTV5+体育赛视", "CCTV5+")
  764. name = name.replace("CCTV5+体育赛事", "CCTV5+")
  765. name = name.replace("CCTV5+体育", "CCTV5+")
  766. results.append(f"{name},{urld}")
  767. except Exception:
  768. pass
  769. return results
  770. except (aiohttp.ClientError, asyncio.TimeoutError, ValueError):
  771. return []
  772. async def main():
  773. x_urls = []
  774. for url in urls:
  775. url = url.strip()
  776. ip_start_index = url.find("//") + 2
  777. ip_end_index = url.find(":", ip_start_index)
  778. ip_dot_start = url.find(".") + 1
  779. ip_dot_second = url.find(".", ip_dot_start) + 1
  780. ip_dot_three = url.find(".", ip_dot_second) + 1
  781. base_url = url[:ip_start_index]
  782. ip_address = url[ip_start_index:ip_dot_three]
  783. port = url[ip_end_index:]
  784. ip_end = "1"
  785. modified_ip = f"{ip_address}{ip_end}"
  786. x_url = f"{base_url}{modified_ip}{port}"
  787. x_urls.append(x_url)
  788. unique_urls = set(x_urls)
  789. semaphore = asyncio.Semaphore(300)
  790. async with aiohttp.ClientSession() as session:
  791. valid_urls = await check_urls(session, unique_urls, semaphore)
  792. all_results = []
  793. tasks = []
  794. for url in valid_urls:
  795. task = asyncio.create_task(fetch_json(session, url, semaphore))
  796. tasks.append(task)
  797. results = await asyncio.gather(*tasks)
  798. for sublist in results:
  799. all_results.extend(sublist)
  800. eventlet.monkey_patch()
  801. task_queue = eventlet.Queue()
  802. results = []
  803. error_channels = []
  804. def worker():
  805. while True:
  806. # 从队列中获取一个任务
  807. channel_name, channel_url = task_queue.get()
  808. try:
  809. channel_url_t = channel_url.rstrip(channel_url.split('/')[-1]) # m3u8链接前缀
  810. lines = requests.get(channel_url, timeout=1).text.strip().split('\n') # 获取m3u8文件内容
  811. ts_lists = [line.split('/')[-1] for line in lines if line.startswith('#') == False] # 获取m3u8文件下视频流后缀
  812. ts_lists_0 = ts_lists[0].rstrip(ts_lists[0].split('.ts')[-1]) # m3u8链接前缀
  813. ts_url = channel_url_t + ts_lists[0] # 拼接单个视频片段下载链接
  814. # 多获取的视频数据进行5秒钟限制
  815. with eventlet.Timeout(5, False):
  816. start_time = datetime.datetime.now().timestamp()
  817. content = requests.get(ts_url, timeout=1).content
  818. end_time = datetime.datetime.now().timestamp()
  819. response_time = (end_time - start_time) * 1
  820. if content:
  821. with open(ts_lists_0, 'ab') as f:
  822. f.write(content) # 写入文件
  823. file_size = len(content)
  824. # print(f"文件大小:{file_size} 字节")
  825. download_speed = file_size / response_time / 1024
  826. # print(f"下载速度:{download_speed:.3f} kB/s")
  827. normalized_speed = min(max(download_speed / 1024, 0.001), 100) # 将速率从kB/s转换为MB/s并限制在1~100之间
  828. # print(f"标准化后的速率:{normalized_speed:.3f} MB/s")
  829. # 删除下载的文件
  830. os.remove(ts_lists_0)
  831. result = channel_name, channel_url, f"{normalized_speed:.3f} MB/s"
  832. results.append(result)
  833. numberx = (len(results) + len(error_channels)) / len(all_results) * 100
  834. current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
  835. print(f"{current_time}可用频道:{len(results)} 个 , 不可用频道:{len(error_channels)} 个 , 总频道:{len(all_results)} 个 ,总进度:{numberx:.2f} %。")
  836. except:
  837. error_channel = channel_name, channel_url
  838. error_channels.append(error_channel)
  839. numberx = (len(results) + len(error_channels)) / len(all_results) * 100
  840. current_time = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
  841. print(f"{current_time}可用频道:{len(results)} 个 , 不可用频道:{len(error_channels)} 个 , 总频道:{len(all_results)} 个 ,总进度:{numberx:.2f} %。")
  842. # 标记任务完成
  843. task_queue.task_done()
  844. def channel_key(channel_name):
  845. match = re.search(r'\d+', channel_name)
  846. if match:
  847. return int(match.group())
  848. else:
  849. return float('inf')
  850. # 创建工作线程
  851. num_workers = 10
  852. #pool = eventlet.GreenPool(num_workers)
  853. for _ in range(num_workers):
  854. #pool.spawn(worker)
  855. t = threading.Thread(target=worker, daemon=True) # 将工作线程设置为守护线程
  856. t.start()
  857. # 将all_results中的数据放入任务队列
  858. for result in all_results:
  859. channel_name, channel_url = result.split(',')
  860. task_queue.put((channel_name, channel_url))
  861. # 等待所有任务完成
  862. task_queue.join()
  863. # 对结果进行排序
  864. #results.sort(key=lambda x: channel_key(x[0]))
  865. results.sort(key=lambda x: (x[0], -float(x[2].split()[0])))
  866. results.sort(key=lambda x: channel_key(x[0]))
  867. result_counter = 8 # 每个频道需要的个数
  868. with open("itvlist.txt", 'w', encoding='utf-8') as file:
  869. channel_counters = {}
  870. file.write('央视频道,#genre#\n')
  871. for result in results:
  872. channel_name, channel_url, speed = result
  873. if 'CCTV' in channel_name:
  874. if channel_name in channel_counters:
  875. if channel_counters[channel_name] >= result_counter:
  876. continue
  877. else:
  878. file.write(f"{channel_name},{channel_url}\n")
  879. channel_counters[channel_name] += 1
  880. else:
  881. file.write(f"{channel_name},{channel_url}\n")
  882. channel_counters[channel_name] = 1
  883. channel_counters = {}
  884. file.write('卫视频道,#genre#\n')
  885. for result in results:
  886. channel_name, channel_url, speed = result
  887. if '卫视' in channel_name:
  888. if channel_name in channel_counters:
  889. if channel_counters[channel_name] >= result_counter:
  890. continue
  891. else:
  892. file.write(f"{channel_name},{channel_url}\n")
  893. channel_counters[channel_name] += 1
  894. else:
  895. file.write(f"{channel_name},{channel_url}\n")
  896. channel_counters[channel_name] = 1
  897. channel_counters = {}
  898. file.write('其他频道,#genre#\n')
  899. for result in results:
  900. channel_name, channel_url, speed = result
  901. if 'CCTV' not in channel_name and '卫视' not in channel_name and '测试' not in channel_name:
  902. if channel_name in channel_counters:
  903. if channel_counters[channel_name] >= result_counter:
  904. continue
  905. else:
  906. file.write(f"{channel_name},{channel_url}\n")
  907. channel_counters[channel_name] += 1
  908. else:
  909. file.write(f"{channel_name},{channel_url}\n")
  910. channel_counters[channel_name] = 1
  911. if __name__ == "__main__":
  912. asyncio.run(main())