File size: 117,886 Bytes
7ccff8b e91f3fe 7ccff8b f149ac1 f719794 7ccff8b f149ac1 7ccff8b 160bef5 7ccff8b 14aa1bb 7ccff8b f719794 e4e5f3c a482033 f719794 e4e5f3c f149ac1 e4e5f3c f149ac1 f719794 160bef5 32a6374 e4e5f3c 7ccff8b e4e5f3c f149ac1 7ccff8b e4e5f3c 7ccff8b f719794 e4e5f3c f719794 e4e5f3c f719794 32a6374 f719794 32a6374 160bef5 32a6374 160bef5 32a6374 f719794 32a6374 f719794 32a6374 f719794 a85ead0 e4e5f3c f719794 e4e5f3c a85ead0 e4e5f3c a85ead0 f719794 e4e5f3c a85ead0 e4e5f3c f719794 32a6374 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 32a6374 f719794 32a6374 f719794 32a6374 2efd5ec e4e5f3c a85ead0 c4258a5 e4e5f3c e91f3fe 7ccff8b f719794 e4e5f3c f719794 c4258a5 f719794 e4e5f3c c4258a5 e4e5f3c c4258a5 e4e5f3c c4258a5 e4e5f3c c4258a5 e4e5f3c c4258a5 e4e5f3c c4258a5 e4e5f3c c4258a5 f719794 32a6374 f719794 2efd5ec f149ac1 e4e5f3c f149ac1 7ccff8b e4e5f3c 7ccff8b f719794 7ccff8b f719794 7ccff8b f719794 7ccff8b f719794 7ccff8b f719794 7ccff8b f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f149ac1 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 f149ac1 e4e5f3c f719794 e4e5f3c f719794 f149ac1 e4e5f3c 87edcd4 e4e5f3c 87edcd4 f719794 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f719794 f149ac1 e4e5f3c f719794 e4e5f3c 7ccff8b e91f3fe f719794 e91f3fe f719794 e4e5f3c f719794 e4e5f3c c4258a5 f719794 e4e5f3c f719794 e4e5f3c f719794 7ccff8b e4e5f3c 7ccff8b f719794 7ccff8b f719794 e4e5f3c f719794 f149ac1 f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c a8e00d6 e4e5f3c f719794 e4e5f3c 7dcc9c1 a8e00d6 e4e5f3c f149ac1 e4e5f3c f719794 87edcd4 f719794 e4e5f3c 7dcc9c1 e4e5f3c f719794 e4e5f3c 7dcc9c1 e4e5f3c f719794 f149ac1 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 f719794 f149ac1 e4e5f3c da5fca6 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c 7dcc9c1 f719794 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c f149ac1 7dcc9c1 f719794 7dcc9c1 e4e5f3c f149ac1 e4e5f3c 7ccff8b e4e5f3c 7ccff8b f719794 a482033 f719794 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c a482033 f149ac1 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c f149ac1 a482033 e4e5f3c f149ac1 e4e5f3c a482033 e4e5f3c f149ac1 a482033 e4e5f3c a482033 f149ac1 a482033 f149ac1 e4e5f3c a482033 f149ac1 a482033 f149ac1 5ba3ba3 a482033 5ba3ba3 a482033 e4e5f3c a482033 e4e5f3c f149ac1 a482033 e4e5f3c f149ac1 a482033 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c f149ac1 f719794 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c a482033 f149ac1 e4e5f3c a482033 e4e5f3c f719794 e4e5f3c f149ac1 a482033 e4e5f3c a482033 f149ac1 a482033 f149ac1 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c f149ac1 e4e5f3c f149ac1 87edcd4 f149ac1 a482033 e4e5f3c a482033 e4e5f3c f149ac1 e4e5f3c a482033 7dcc9c1 e4e5f3c f149ac1 e4e5f3c da5fca6 e4e5f3c f149ac1 a482033 e4e5f3c f149ac1 a482033 f149ac1 e4e5f3c 7dcc9c1 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c f149ac1 e4e5f3c 7dcc9c1 a482033 f149ac1 a482033 7dcc9c1 e4e5f3c a482033 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f719794 e4e5f3c f149ac1 e4e5f3c f719794 87edcd4 e4e5f3c a8e00d6 e4e5f3c f149ac1 f719794 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f719794 f149ac1 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c 7dcc9c1 e4e5f3c da5fca6 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c f719794 e4e5f3c f719794 7dcc9c1 e4e5f3c f719794 e4e5f3c f719794 87edcd4 e4e5f3c 7dcc9c1 87edcd4 7dcc9c1 f719794 e4e5f3c 7dcc9c1 e4e5f3c f719794 7dcc9c1 f149ac1 e4e5f3c da5fca6 e4e5f3c f719794 e4e5f3c 7dcc9c1 e4e5f3c f719794 7dcc9c1 f719794 7dcc9c1 f719794 7dcc9c1 e4e5f3c 7dcc9c1 e4e5f3c f719794 a482033 f719794 a482033 f719794 e4e5f3c f149ac1 e4e5f3c f719794 e4e5f3c a482033 e4e5f3c a482033 e4e5f3c f719794 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c da5fca6 f149ac1 da5fca6 f149ac1 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c a482033 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f149ac1 a482033 da5fca6 a482033 da5fca6 a482033 da5fca6 a482033 da5fca6 a482033 da5fca6 a482033 da5fca6 a482033 da5fca6 a482033 e4e5f3c a482033 e4e5f3c c1318bb e4e5f3c c1318bb f149ac1 e4e5f3c f719794 a482033 e4e5f3c f719794 f149ac1 e4e5f3c f719794 e4e5f3c a482033 c1318bb e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f719794 f149ac1 e4e5f3c f719794 c1318bb f149ac1 e4e5f3c f149ac1 c1318bb f149ac1 e4e5f3c f149ac1 e4e5f3c f719794 f149ac1 e4e5f3c f149ac1 5ba3ba3 e4e5f3c 5ba3ba3 e4e5f3c f719794 e4e5f3c 5ba3ba3 e4e5f3c f149ac1 e4e5f3c f149ac1 e4e5f3c f719794 f149ac1 e4e5f3c f719794 e4e5f3c f149ac1 e4e5f3c f149ac1 2efd5ec e4e5f3c f149ac1 e4e5f3c 2efd5ec e4e5f3c 7ccff8b e4e5f3c 7ccff8b e4e5f3c a482033 e4e5f3c f719794 a482033 e4e5f3c c4258a5 e4e5f3c c1318bb f719794 f149ac1 e4e5f3c c1318bb e4e5f3c f719794 e4e5f3c 7ccff8b f719794 32a6374 f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 e4e5f3c f719794 97b014f e4e5f3c 97b014f f719794 e4e5f3c 55774c6 e4e5f3c 97b014f e4e5f3c 97b014f f719794 e4e5f3c 7ccff8b e4e5f3c f149ac1 e4e5f3c da5fca6 a482033 da5fca6 e4e5f3c da5fca6 e4e5f3c 55774c6 e4e5f3c da5fca6 e4e5f3c 55774c6 e4e5f3c da5fca6 e4e5f3c 55774c6 e4e5f3c da5fca6 e4e5f3c 55774c6 e4e5f3c da5fca6 e4e5f3c f719794 da5fca6 a482033 e4e5f3c f719794 7ccff8b 55774c6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 | import gradio as gr
import os
import time
import json
import re
import smtplib
import requests
import random
import threading
import hashlib
from datetime import datetime, timedelta
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.utils import formataddr, make_msgid
from openai import OpenAI
from apscheduler.schedulers.background import BackgroundScheduler
from upstash_redis import Redis as UpstashRedis
os.environ["TZ"] = "UTC"
# ==========================================
# 1. ุฅุนุฏุงุฏุงุช ุงูุจูุฆุฉ ูุงูู
ูุงุชูุญ
# ==========================================
NVIDIA_API_KEY = os.getenv("NVIDIA_API_KEY")
GITHUB_TOKEN = os.getenv("GITHUB_TOKEN")
# Reddit โ Cookies ู
ู state.json (ูุง ูุญุชุงุฌ API ุฃู Client ID)
# Reddit OAuth โ ูุญุชุงุฌ: REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET, REDDIT_USERNAME, REDDIT_PASSWORD
# ุงุฐูุจ ูู reddit.com/prefs/apps โ Create App โ script โ ุงุญุตู ุนูู ID ู Secret
REDDIT_CLIENT_ID = os.getenv("REDDIT_CLIENT_ID", "")
REDDIT_CLIENT_SECRET = os.getenv("REDDIT_CLIENT_SECRET", "")
REDDIT_USERNAME = os.getenv("REDDIT_USERNAME", "")
REDDIT_PASSWORD = os.getenv("REDDIT_PASSWORD", "")
SMTP_EMAIL = os.getenv("SMTP_EMAIL")
SMTP_PASSWORD = os.getenv("SMTP_PASSWORD")
DEVTO_API_KEY = os.getenv("DEVTO_API_KEY") # ุงุฎุชูุงุฑู
DISCORD_BOT_TOKEN = os.getenv("DISCORD_BOT_TOKEN") # ุงุฎุชูุงุฑู
# DISCORD_GUILD_IDS ูู
ูุนุฏ ู
ุทููุจุงู โ ุงูุณูุฑูุฑุงุช ุชููุชุดู ุชููุงุฆูุงู
# โโ ุงูุชุดุงู SMTP ุชููุงุฆู ุจูุงุกู ุนูู ุฏูู
ูู ุงูุฅูู
ูู โโโโโโโโโโโโโโโโโโโโโโโโโโ
# Namecheap: mail.yourdomain.com port 587 (ููู
ุฉ ุงูู
ุฑูุฑ ุงูุนุงุฏูุฉ ู
ุจุงุดุฑุฉ)
# Gmail: smtp.gmail.com port 587 (ูุญุชุงุฌ App Password)
# Outlook: smtp.office365.com port 587
def _detect_smtp(email: str) -> tuple:
if not email:
return "smtp.gmail.com", 587
domain = email.split("@")[-1].lower()
TABLE = {
"gmail.com": ("smtp.gmail.com", 587),
"googlemail.com": ("smtp.gmail.com", 587),
"outlook.com": ("smtp.office365.com", 587),
"hotmail.com": ("smtp.office365.com", 587),
"live.com": ("smtp.office365.com", 587),
"yahoo.com": ("smtp.mail.yahoo.com", 587),
"icloud.com": ("smtp.mail.me.com", 587),
"protonmail.com": ("smtp.protonmail.com", 587),
"zoho.com": ("smtp.zoho.com", 587),
"zohomail.com": ("smtp.zoho.com", 587),
}
if domain in TABLE:
return TABLE[domain]
# ุฏูู
ูู ุฎุงุต โ Namecheap / cPanel / Hostinger / SiteGround
return f"mail.{domain}", 587
SMTP_SERVER, SMTP_PORT = _detect_smtp(SMTP_EMAIL)
print(f"๐ง SMTP auto-detected: {SMTP_SERVER}:{SMTP_PORT}")
SITE_URL = "https://www.orgteh.com"
UPSTASH_REDIS_REST_URL = os.getenv("UPSTASH_REDIS_REST_URL")
UPSTASH_REDIS_REST_TOKEN = os.getenv("UPSTASH_REDIS_REST_TOKEN")
# ุญุฏูุฏ ููู
ูุฉ โ ู
ูุฒุนุฉ ูุชุตู ุงูู
ุฌู
ูุน 1000-10000/ููู
# Email: ุงูุฃุนูู ูุฃู ุงูุฅูู
ูู ู
ุฏููุน ูุขู
ู
# GitHub: ู
ุชูุณุท ู
ุน ููุชุฑ ุตุงุฑู
ููู
ุจุชุฏุฆูู
# Reddit/Dev.to/Discord: ู
ุญุงูุธุฉ ูุณุจูุงู ูุชุฌูุจ ุงูุญุธุฑ
LIMITS = {
"email_daily": 5000, # ุฅูู
ูู ู
ุฏููุน โ ุญุฌู
ูุจูุฑ
"github_daily": 3000, # Issues ูุซูุฑุฉ ููู ููุชุฑ ุตุงุฑู
"reddit_daily": 300, # Reddit ุญุณุงุณ โ ู
ุชูุณุท
"devto_daily": 500, # Dev.to ุฃูุซุฑ ุชุณุงู
ุญุงู
"stackoverflow_daily": 500,
"producthunt_daily": 200,
"discord_daily": 200,
}
# ==========================================
# 2. ูุธุงู
ุงูุฐุงูุฑุฉ ุงูุญุฏูุฏูุฉ (Iron Memory)
# ==========================================
class IronMemory:
"""
ูุญูุธ ูู URL / ู
ุนุฑู ู
ุณุชุฎุฏู
ุชู
ุงูุชุนุงู
ู ู
ุนู ุจุดูู ุฏุงุฆู
.
ูุนู
ู ุนูู ุทุจูุชูู: ุฐุงูุฑุฉ ู
ุญููุฉ (ุณุฑูุนุฉ) + Upstash Redis (ุณุญุงุจูุฉ / ุฏุงุฆู
ุฉ).
ูู ูุนูุฏ ูุฃู ุดุฎุต ุฃู ุฑุงุจุท ุชู
ุญูุธู ุฃุจุฏุงู ุญุชู ุจุนุฏ ุฅุนุงุฏุฉ ุงูุชุดุบูู.
"""
SET_KEY = "orgteh:processed"
LOGS_KEY = "orgteh:logs"
USERS_KEY = "orgteh:users" # ู
ุฌู
ูุนุฉ ู
ุนุฑูุงุช ุงูู
ุณุชุฎุฏู
ูู ุชุญุฏูุฏุงู
def __init__(self):
self._local: set = set()
self._users: set = set()
self.redis = None
self.enabled = False
if UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN:
try:
self.redis = UpstashRedis(url=UPSTASH_REDIS_REST_URL, token=UPSTASH_REDIS_REST_TOKEN)
self.redis.ping()
self.enabled = True
print("โ
Iron Memory: Upstash Redis ู
ุชุตู โ ุงูุฐุงูุฑุฉ ุงูุฏุงุฆู
ุฉ ูุดุทุฉ")
except Exception as e:
print(f"โ Upstash ุฎุทุฃ: {e} โ ุณูุนู
ู ุงููุธุงู
ุจุฐุงูุฑุฉ ู
ุคูุชุฉ ููุท")
else:
print("โ ๏ธ ุจูุงูุงุช Upstash ุบูุฑ ู
ูุฌูุฏุฉ โ ุงูุฐุงูุฑุฉ ู
ุคูุชุฉ ููุท")
# --- ูุญุต ---
def seen(self, key: str) -> bool:
if key in self._local:
return True
if self.enabled:
try:
return bool(self.redis.sismember(self.SET_KEY, key))
except:
pass
return False
def user_seen(self, user_id: str) -> bool:
if user_id in self._users:
return True
if self.enabled:
try:
return bool(self.redis.sismember(self.USERS_KEY, user_id))
except:
pass
return False
# --- ุชุณุฌูู ---
def mark(self, key: str):
self._local.add(key)
if self.enabled:
try:
self.redis.sadd(self.SET_KEY, key)
except:
pass
def mark_user(self, user_id: str):
self._users.add(user_id)
if self.enabled:
try:
self.redis.sadd(self.USERS_KEY, user_id)
except:
pass
# --- ุงูุณุฌูุงุช ---
def log(self, platform, title, url, snippet, reply):
entry = {
"ts": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"platform": platform,
"title": title,
"url": url,
"snippet": (snippet or "")[:400],
"reply": reply,
}
LOCAL_LOGS.insert(0, entry)
if len(LOCAL_LOGS) > 200:
LOCAL_LOGS.pop()
if self.enabled:
try:
self.redis.lpush(self.LOGS_KEY, json.dumps(entry, ensure_ascii=False))
self.redis.ltrim(self.LOGS_KEY, 0, 499)
except:
pass
return entry
def load_logs(self):
"""ูุฌูุจ ุงูุณุฌู ู
ู Redis ุฃู ุงูุฐุงูุฑุฉ ุงูู
ุญููุฉ."""
if self.enabled:
try:
raw = self.redis.lrange(self.LOGS_KEY, 0, 99)
result = []
for item in raw:
try:
# upstash-redis ูุฏ ูุฑุฌุน string ุฃู dict ู
ุจุงุดุฑุฉ
if isinstance(item, dict):
result.append(item)
elif isinstance(item, (str, bytes)):
result.append(json.loads(item))
except:
pass
if result:
return result
except Exception as e:
print(f" load_logs Redis error: {e}")
return LOCAL_LOGS[:]
def save_stats(self, stats: dict):
"""ูุญูุธ ุงูุฅุญุตุงุฆูุงุช ุงูููู
ูุฉ ูู Redis."""
if self.enabled:
try:
today = datetime.utcnow().strftime("%Y-%m-%d")
self.redis.set(f"orgteh:stats:{today}", json.dumps(stats))
except:
pass
def load_stats(self) -> dict:
"""ูุฌูุจ ุฅุญุตุงุฆูุงุช ุงูููู
ู
ู Redis."""
if self.enabled:
try:
today = datetime.utcnow().strftime("%Y-%m-%d")
raw = self.redis.get(f"orgteh:stats:{today}")
if raw:
if isinstance(raw, dict):
return raw
return json.loads(raw)
except:
pass
return {}
memory = IronMemory()
LOCAL_LOGS = []
LOCAL_STATS = {
"reddit": 0, "github": 0, "email": 0,
"devto": 0, "stackoverflow": 0, "producthunt": 0, "discord": 0,
"emails_found": 0, "emails_queued": 0, "emails_sent": 0,
"replies_received": 0,
}
# ==========================================
# ุณุฌู ุงููุดุงุท ุงูุชูุตููู (ููู ุนู
ููุฉ ุจุญุซ)
# ==========================================
ACTIVITY_LOGS: list = [] # ุจุญุซุ ุฅูู
ููุงุช ููุฌุฏุชุ ุชุนูููุงุช ุฃูุฑุณูุช
SENT_EMAILS_LOG: list = [] # ุณุฌู ุงูุฅูู
ููุงุช ุงูู
ุฑุณูุฉ
REPLIES_LOG: list = [] # ุฑุฏูุฏ ุงูู
ุณุชุฎุฏู
ูู ุนูู ุชุนูููุงุชูุง
_activity_lock = threading.Lock()
# ุฌู
ุน ู
ุนุฑูุงุช ุชุนูููุงุชูุง ูู
ุชุงุจุนุฉ ุงูุฑุฏูุฏ ุนูููุง
_our_github_comments: list = [] # [(repo_api_url, comment_id, title), ...]
_our_reddit_comments: list = [] # [(post_url, comment_fullname, title), ...]
_our_comments_lock = threading.Lock()
def log_activity(platform: str, action: str, site: str,
found: int = 0, note: str = "", level: str = "info"):
"""
ูุณุฌูู ูุดุงุทุงู ุชูุตูููุงู ูุนู
ููุฉ ุจุญุซ ุฃู ุฅุฑุณุงู.
level: info | success | warn | error
"""
icon_map = {
"info": "๐",
"success": "โ
",
"warn": "โ ๏ธ",
"error": "โ",
}
entry = {
"ts": datetime.now().strftime("%H:%M:%S"),
"platform": platform,
"action": action,
"site": site,
"found": found,
"note": note,
"level": level,
"icon": icon_map.get(level, "๐"),
}
with _activity_lock:
ACTIVITY_LOGS.insert(0, entry)
if len(ACTIVITY_LOGS) > 600:
ACTIVITY_LOGS.pop()
def log_sent_email(to: str, subject: str, body: str, url: str, title: str):
entry = {
"ts": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"to": to,
"subject": subject,
"body": body[:300],
"url": url,
"title": title,
}
with _activity_lock:
SENT_EMAILS_LOG.insert(0, entry)
if len(SENT_EMAILS_LOG) > 300:
SENT_EMAILS_LOG.pop()
def log_reply(platform: str, from_user: str, our_content: str,
their_reply: str, url: str):
entry = {
"ts": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
"platform": platform,
"from_user": from_user,
"our_content": our_content[:200],
"their_reply": their_reply[:400],
"url": url,
}
with _activity_lock:
REPLIES_LOG.insert(0, entry)
if len(REPLIES_LOG) > 200:
REPLIES_LOG.pop()
LOCAL_STATS["replies_received"] = LOCAL_STATS.get("replies_received", 0) + 1
# ==========================================
# 3. ู
ุญุฑู ุงูุฐูุงุก ุงูุงุตุทูุงุนู
# ==========================================
client = OpenAI(base_url="https://integrate.api.nvidia.com/v1", api_key=NVIDIA_API_KEY)
def ask_ai(prompt: str, system: str = "You are a helpful assistant.", temp=0.5) -> str | None:
try:
resp = client.chat.completions.create(
model="meta/llama-3.3-70b-instruct",
messages=[{"role": "system", "content": system}, {"role": "user", "content": prompt}],
temperature=temp, max_tokens=900
)
return resp.choices[0].message.content.strip()
except Exception as e:
print(f"AI Error: {e}")
return None
# ==========================================
# 4. ูุธุงู
ููู
ุงุช ุงูุจุญุซ ุงูุฐูู โ ุชููุงุฆู 100%
# ==========================================
# ุทุจูุชุงู:
# 1. FALLBACK_KEYWORDS โ ููู
ุงุช ุซุงุจุชุฉ ูุถู
ุงู ุงูุนู
ู ุฏุงุฆู
ุงู
# 2. ูู KEYWORD_REFRESH_MINUTES ูุทูุจ ุงููู
ูุฐุฌ ุชูููุฏ ููู
ุงุช ุฌุฏูุฏุฉ ุจููุณู
# ุจูู ุงููุบุงุช ุงูู
ู
ููุฉ ุจูุงุกู ุนูู ู
ุง ูุนุฑูู ุนู Orgteh ูุณูู AI API
# โโ ููู
ุงุช ุซุงุจุชุฉ (Fallback) โ ุฌู
ููุฑุงู: ู
ุทูุฑู AI API + ุฃุตุญุงุจ ุงูู
ูุงูุน โโ
FALLBACK_KEYWORDS: list[str] = [
# โโโโ ุฌู
ููุฑ 1: ู
ุทูุฑู AI API โโโโ
# EN โ API developers
"llm api", "ai api", "chatbot api", "language model api",
"integrate llm", "openai api", "deepseek api", "mistral api",
"llama api", "chat completions api", "ai api developer",
"openai api alternative", "cheap llm api",
# AR โ ู
ุทูุฑู API (ุนุฑุจู โ ุฃููููุฉ ุนุงููุฉ)
"api ุฐูุงุก ุงุตุทูุงุนู", "ูุงุฌูุฉ ุจุฑู
ุฌูุฉ ูู
ูุฐุฌ ูุบูู", "ุฏู
ุฌ ูู
ูุฐุฌ ุฐูุงุก ุงุตุทูุงุนู",
"api ูููู
ุงุฐุฌ ุงููุบููุฉ", "ุจูุงุก ุชุทุจูู ุฐูุงุก ุงุตุทูุงุนู api",
"ููู ุฃุณุชุฎุฏู
api ุงูุฐูุงุก ุงูุงุตุทูุงุนู", "ูู
ูุฐุฌ ูุบูู api",
"ุจุฏูู openai ุฑุฎูุต", "api ุฐูุงุก ุงุตุทูุงุนู ู
ุฌุงูู",
# TR / FR / ES / DE / PT / RU / ZH / JA / KO / HI / ID
"yapay zeka api", "llm api entegrasyonu",
"api intelligence artificielle", "intรฉgrer llm api",
"api inteligencia artificial", "integrar llm api",
"ki api", "sprachmodell api",
"api inteligรชncia artificial", "chatbot api integraรงรฃo",
"ัะทัะบะพะฒะฐั ะผะพะดะตะปั api", "llm api ะธะฝัะตะณัะฐัะธั",
"ๅคง่ฏญ่จๆจกๅ api", "ai api ๆฅๅ
ฅ",
"llm api ็ตฑๅ", "่จ่ชใขใใซ api",
"llm api ํตํฉ", "์ฑ๋ด api ์ฐ๋",
"ai api เคเคเคเฅเคเฅเคฐเฅเคถเคจ", "chatbot api developer",
# โโโโ ุฌู
ููุฑ 2: ุฃุตุญุงุจ ุงูู
ูุงูุน โ chatbot / ุฎุฏู
ุฉ ุนู
ูุงุก โโโโ
# EN โ website owners / customer service
"add chatbot to website",
"ai customer service chatbot",
"chatbot for my website",
"automated customer support",
"ai support widget",
"customer service automation",
"embed chatbot website",
"ai chat widget",
"24/7 customer support ai",
"chatbot ecommerce store",
"automate customer questions",
"website chatbot no code",
"ai answers customer questions",
"chatbot for small business",
"install chatbot website",
# AR โ ุฃุตุญุงุจ ุงูู
ูุงูุน / ุฎุฏู
ุฉ ุงูุนู
ูุงุก (ุนุฑุจู โ ุฃููููุฉ ุนุงููุฉ)
"ุฅุถุงูุฉ ุดุงุช ุจูุช ููู
ููุน",
"ุฑูุจูุช ู
ุญุงุฏุซุฉ ูุฎุฏู
ุฉ ุงูุนู
ูุงุก",
"ุงุชู
ุชุฉ ุฎุฏู
ุฉ ุงูุนู
ูุงุก",
"ุดุงุช ุจูุช ูู
ููุนู",
"ู
ุณุงุนุฏ ุฐูู ููู
ููุน",
"ุฎุฏู
ุฉ ุนู
ูุงุก ุขููุฉ",
"ููุฏุฌูุช ุดุงุช ุจูุช ุนุฑุจู",
"ุฑูุจูุช ู
ุญุงุฏุซุฉ ููู
ุชุฌุฑ ุงูุฅููุชุฑููู",
"ููู ุฃุถูู ุดุงุช ุจูุช ูู
ููุนู",
"ุฃุชู
ุชุฉ ุงูุฑุฏูุฏ ุนูู ุงูุนู
ูุงุก",
"ุจูุช ุฎุฏู
ุฉ ุนู
ูุงุก ููู
ููุน",
"ุดุงุช ุจูุช ูู
ุชุฌุฑ ุณูุฉ ุฒูุฏ",
"ุฏุนู
ุนู
ูุงุก ุชููุงุฆู",
# TR
"web sitesine chatbot ekle", "mรผลteri hizmetleri botu",
"otomatik mรผลteri desteฤi",
# FR
"chatbot service client", "ajouter chatbot site web",
"support client automatisรฉ",
# ES
"chatbot atenciรณn al cliente", "aรฑadir chatbot sitio web",
"soporte cliente automatizado",
# DE
"chatbot kundendienst", "chatbot website einbinden",
"automatischer kundensupport",
# PT
"chatbot atendimento cliente", "adicionar chatbot site",
# RU
"ัะฐัะฑะพั ัะปัะถะฑะฐ ะฟะพะดะดะตัะถะบะธ", "ะดะพะฑะฐะฒะธัั ัะฐัะฑะพั ัะฐะนั",
# ZH
"็ฝ็ซๆทปๅ ่ๅคฉๆบๅจไบบ", "ๅฎขๆ่ๅคฉๆบๅจไบบ",
# ID
"chatbot layanan pelanggan", "tambah chatbot ke website",
]
KEYWORD_REFRESH_MINUTES = 90 # ูู 90 ุฏูููุฉ ูุทูุจ ููู
ุงุช ุฌุฏูุฏุฉ
_keyword_cache: list[str] = list(FALLBACK_KEYWORDS)
_last_keyword_refresh: float = 0.0
_keyword_lock = threading.Lock()
def _ai_generate_keywords() -> list[str]:
"""
ูุทูุจ ู
ู ุงููู
ูุฐุฌ ุชูููุฏ ููู
ุงุช ุจุญุซ ูุฌู
ููุฑูู:
1. ู
ุทูุฑูู ูุฑูุฏูู AI API
2. ุฃุตุญุงุจ ู
ูุงูุน ูุฑูุฏูู chatbot / widget ูุฎุฏู
ุฉ ุงูุนู
ูุงุก
ุจูู ุงููุบุงุช ุงูู
ู
ููุฉ โ ุฎุงุตุฉ ุงูุนุฑุจูุฉ.
"""
prompt = """You are marketing Orgteh (orgteh.com) which has TWO products:
1. AI API for developers (OpenAI-compatible, cheap, multiple models)
2. AI Customer Service Widget โ embed a chatbot on any website in minutes, reads site content automatically (RAG)
Generate 60 short search keywords (2-5 words) to find BOTH audiences across the internet.
TARGET AUDIENCE 1 โ Developers:
- Want to USE an AI/LLM API for projects
- Building chatbots, apps, integrations
- Looking for cheaper OpenAI alternatives
TARGET AUDIENCE 2 โ Website/Business Owners:
- Want to add a chatbot to their website
- Need automated customer service / support
- E-commerce, SaaS, service businesses
- May not be technical โ want a simple widget
LANGUAGE COVERAGE (this is critical):
- Arabic (ุนุฑุจู) โ HIGH PRIORITY, include at least 15 Arabic keywords
- English โ HIGH PRIORITY
- Turkish, French, Spanish, German, Portuguese, Russian, Chinese, Japanese, Korean, Indonesian, Hindi
RULES:
- Keywords must be SHORT and natural (how people actually search)
- Mix both audiences proportionally
- Arabic keywords should sound natural, not machine-translated
- Output ONLY a JSON array, no explanation:
["keyword1", "keyword2", ...]"""
resp = ask_ai(prompt, temp=0.8)
if resp:
try:
m = re.search(r'\[.*\]', resp, re.DOTALL)
if m:
keywords = json.loads(m.group(0))
valid = [k.strip() for k in keywords if isinstance(k, str) and 2 < len(k.strip()) < 60]
if len(valid) >= 10:
print(f"๐ Keywords refreshed: {len(valid)} new keywords generated by AI")
return valid
except Exception as e:
print(f"Keyword generation parse error: {e}")
return []
def refresh_keywords_if_needed():
"""ูุฌุฏุฏ ููู
ุงุช ุงูุจุญุซ ุชููุงุฆูุงู ูู KEYWORD_REFRESH_MINUTES."""
global _keyword_cache, _last_keyword_refresh
now = time.time()
with _keyword_lock:
if now - _last_keyword_refresh > KEYWORD_REFRESH_MINUTES * 60:
new_kws = _ai_generate_keywords()
if new_kws:
# ูู
ุฒุฌ ุงูููู
ุงุช ุงูุฌุฏูุฏุฉ ู
ุน ุงูุซุงุจุชุฉ ูุถู
ุงู ุงูุชุบุทูุฉ
_keyword_cache = list(set(FALLBACK_KEYWORDS + new_kws))
_last_keyword_refresh = now
def _keyword_refresh_loop():
"""ุฎูุท ู
ุณุชูู ูุฌุฏุฏ ุงูููู
ุงุช ุจุดูู ุฏูุฑู."""
# ุชูููุฏ ููุฑู ุนูุฏ ุงูุจุฏุก
refresh_keywords_if_needed()
while True:
time.sleep(KEYWORD_REFRESH_MINUTES * 60)
refresh_keywords_if_needed()
def get_random_keywords(n: int = 3) -> list[str]:
"""ูุฎุชุงุฑ n ููู
ุงุช ุนุดูุงุฆูุฉ ู
ู ุงููุงุด ุงูุญุงูู (ุซุงุจุชุฉ + ู
ูููุฏุฉ)."""
with _keyword_lock:
pool = _keyword_cache if _keyword_cache else FALLBACK_KEYWORDS
return random.sample(pool, min(n, len(pool)))
# ==========================================
# 5. ู
ูููุฏ ุงูุฑุฏูุฏ ุงูุฐูู
# ==========================================
# โโ ูุตู ุงูุฎุฏู
ุชูู ุงููุชูู ูุณููู ููู
ุง โโ
SITE_CONTEXT = """
Orgteh (orgteh.com) offers TWO main products:
PRODUCT 1 โ AI API for Developers:
- OpenAI-compatible endpoint: https://orgteh.com/v1/chat/completions
- Multiple models: DeepSeek-R1, Kimi (256K context), Mistral, Llama-3B, Gemma
- API keys start with "Orgteh_"
- GPU-accelerated, sub-second response, enterprise security, streaming
- Drop-in replacement for OpenAI (zero code changes)
- Registration: orgteh.com/register
PRODUCT 2 โ AI Customer Service Widget (NEW):
- A ready-made chatbot widget you embed on ANY website in minutes (one script tag)
- The AI reads YOUR website content automatically (RAG โ no manual training needed)
- Answers customer questions 24/7 in any language based on your own content
- Perfect for: e-commerce stores, SaaS products, service businesses, startups
- No coding required โ just paste the script and it works
- orgteh.com/widget
"""
# ุฃู ู
ูุชุฌ ูุฑููุฌ ูู ุจูุงุกู ุนูู ู
ู ูุชุญุฏุซ ู
ุนู
AUDIENCE_API = "api_developer" # ู
ุทูุฑ ูุฑูุฏ ุงุณุชุฎุฏุงู
AI API
AUDIENCE_WIDGET = "website_owner" # ุตุงุญุจ ู
ููุน ูุฑูุฏ chatbot ูุฎุฏู
ุฉ ุงูุนู
ูุงุก
REPLY_STYLES = [
"casual_developer", # ู
ุทูุฑ ูุดุงุฑู ุชุฌุฑุจุชู
"helpful_peer", # ุฒู
ูู ูุณุงุนุฏ
"been_there", # ุดุฎุต ู
ุฑ ุจููุณ ุงูู
ุดููุฉ
]
def ai_judge(text: str) -> str | None:
"""
ููุชุฑ ุตุงุฑู
โ ูุฑูุถ ุฃู ุดูุก ุบูุฑ ู
ุฑุชุจุท ู
ุจุงุดุฑุฉ ุจู
ูุชุฌุงุชูุง.
ูุฑุฌุน: "api_developer" | "website_owner" | None
"""
prompt = (
"Read this text carefully:\n"
"---\n"
+ text[:500] +
"\n---\n\n"
"Does this person have an ACTIVE, CONCRETE need for one of these:\n"
" API_DEVELOPER: They are RIGHT NOW trying to USE or INTEGRATE an AI/LLM API "
"in a real project they are building. They need API access, keys, endpoints, or a cheaper alternative.\n"
" WEBSITE_OWNER: They RIGHT NOW want to ADD a chatbot/AI assistant to their website "
"for customer service, support automation, or answering visitor questions.\n"
" NONE: Everything else โ bugs in other software, general AI discussion, "
"account/billing issues, feature requests for other products, research, news.\n\n"
"STRICT RULES:\n"
"- Bug reports about OTHER software = NONE\n"
"- Account/billing/verification issues = NONE\n"
"- General AI news or opinions = NONE\n"
"- Contributing to open source AI projects = NONE\n"
"- Only classify as API_DEVELOPER or WEBSITE_OWNER if the need is DIRECT and IMMEDIATE\n\n"
"Answer ONE word only: API_DEVELOPER, WEBSITE_OWNER, or NONE\nAnswer:"
)
resp = ask_ai(prompt, temp=0.0)
if not resp:
return None
r = resp.strip().upper()
if r.startswith("API_DEVELOPER"):
return AUDIENCE_API
if r.startswith("WEBSITE_OWNER"):
return AUDIENCE_WIDGET
return None
def ai_judge_github(text: str, repo: str = "") -> bool:
"""
ููุชุฑ GitHub ุฅุถุงูู โ ูุฑูุถ:
- ู
ุณุชูุฏุนุงุช ู
ุดุงุฑูุน AI ูุจูุฑุฉ (LibreChat, Ollama, LangChain...)
- Issues ุชูููุฉ ุนู
ููุฉ (bugs, architecture, performance)
- ุฃู ุดูุก ูุง ูุทูุจ ููู ุงูุดุฎุต API ุฌุงูุฒ ููุงุณุชุฎุฏุงู
"""
# ุฑูุถ ุณุฑูุน ููู
ุณุชูุฏุนุงุช ุงูู
ุนุฑููุฉ
BLOCKED_REPOS = [
"anthropic", "openai", "microsoft", "google", "meta-llama",
"ollama", "librechat", "langchain", "huggingface", "mistralai",
"deepseek", "cohere", "stability-ai", "AUTOMATIC1111",
"lm-sys", "ggerganov", "Mozilla-Ocho", "BerriAI",
]
repo_lower = repo.lower()
if any(b.lower() in repo_lower for b in BLOCKED_REPOS):
return False
prompt = (
"Read this GitHub issue:\n"
"---\n"
+ text[:400] +
"\n---\n\n"
"Answer YES only if ALL of these are true:\n"
"1. The person wants to USE an AI API in their OWN project (not contribute to one)\n"
"2. They are a beginner or non-expert looking for a READY solution\n"
"3. The issue is NOT a bug report, NOT a feature request for another product\n"
"4. The repo is NOT a major AI framework or company's official repo\n\n"
"Answer NO if any of these apply:\n"
"- Bug in someone else's software\n"
"- Account, billing, or verification problem\n"
"- Advanced technical discussion\n"
"- Contributing to an AI library\n\n"
"Answer ONE word: YES or NO\nAnswer:"
)
resp = ask_ai(prompt, temp=0.0)
return bool(resp and resp.strip().upper().startswith("YES"))
REPLY_STYLES_API = [
"casual_developer", # ู
ุทูุฑ ูุดุงุฑู ุชุฌุฑุจุชู ุจุดูู ุบูุฑ ุฑุณู
ู
"helpful_peer", # ุฒู
ูู ูุณุงุนุฏ ููุดูุฑ ููุญู
"been_there", # ุดุฎุต ู
ุฑ ุจููุณ ุงูู
ุดููุฉ ุจุงูุถุจุท
]
REPLY_STYLES_WIDGET = [
"satisfied_user", # ุตุงุญุจ ู
ููุน ุฌุฑูุจ ุงูููุฏุฌูุช ูุฃุนุฌุจู
"helpful_fellow", # ุดุฎุต ููุชุฑุญ ุญูุงู ุฌุงูุฒุงู ูู
ุดููุฉ ุฎุฏู
ุฉ ุงูุนู
ูุงุก
"early_adopter", # ุดุฎุต ุงูุชุดู ุงูุญู ู
ุจูุฑุงู ููุฑูุฏ ู
ุดุงุฑูุชู
]
def generate_reply(content: str, platform: str, audience: str | None = None) -> str | None:
"""
ูููุฏ ุฑุฏ ุทุจูุนู ููุงุณุจ ููุน ุงูุฌู
ููุฑ:
- api_developer โ ูุชุญุฏุซ ุนู AI API
- website_owner โ ูุชุญุฏุซ ุนู ุงูููุฏุฌูุช ูุฎุฏู
ุฉ ุงูุนู
ูุงุก
"""
if audience == AUDIENCE_WIDGET:
style = random.choice(REPLY_STYLES_WIDGET)
prompt = f"""
You are a website owner who installed the Orgteh AI widget on your site and love it.
You found this post on {platform} from someone who needs automated customer service or a chatbot for their website.
You want to genuinely help by sharing what worked for you.
ABOUT THE WIDGET:
{SITE_CONTEXT}
POST CONTENT:
---
{content[:700]}
---
YOUR STYLE: {style}
STRICT RULES:
1. Detect the language and reply in THE SAME LANGUAGE โ if Arabic, reply in Arabic.
2. Write as a REAL website owner, NOT a company. Use "I" not "we".
3. Sound natural and helpful. NOT promotional.
4. Keep it SHORT (3-5 sentences max).
5. Mention orgteh.com/widget naturally โ like you discovered it and it solved your problem.
6. Focus on: easy setup (one script), reads website automatically, answers customers 24/7.
7. DO NOT start with "Hi/Hello". DO NOT use bullet points.
8. Output ONLY the reply text.
Examples (adapt to language):
- "Went through the same thing โ ended up using the widget from orgteh.com, took me like 5 minutes to install..."
- "I added a chatbot to my store using orgteh.com/widget, it reads all my product pages automatically..."
- "ุนูุฏู ููุณ ุงูู
ูุถูุน ูู ู
ููุนูุ ุฌุฑุจุช ููุฏุฌูุช orgteh.com ูุฑููุจุชู ุจุณุทุฑููุ ููุฑุฃ ุงูู
ููุน ูุญุงูู..."
- "ููุช ุฃุจุญุซ ุนู ููุณ ุงูุดูุกุ ูุฌุฏุช orgteh.com/widgetุ ูุฑุฏ ุนูู ุฃุณุฆูุฉ ุงูุนู
ูุงุก ุชููุงุฆูุงู..."
"""
else:
# AUDIENCE_API ุฃู ุบูุฑ ู
ุญุฏุฏ
style = random.choice(REPLY_STYLES_API)
prompt = f"""
You are a developer who uses Orgteh (orgteh.com) for AI API access.
You found this post on {platform} and want to genuinely help.
ABOUT ORGTEH:
{SITE_CONTEXT}
POST CONTENT:
---
{content[:700]}
---
YOUR STYLE: {style}
STRICT RULES:
1. Detect the language and reply in THE SAME LANGUAGE โ if Arabic, reply in Arabic.
2. Write as a REAL developer. Use "I" not "we".
3. Sound natural and conversational. NOT salesy.
4. Keep it SHORT (3-5 sentences max).
5. Mention orgteh.com naturally.
6. Only mention features relevant to their specific problem.
7. DO NOT start with "Hi/Hello". DO NOT use bullet points.
8. Output ONLY the reply text.
Examples (adapt to language/situation):
- "Been using orgteh.com API for this, works well โ OpenAI-compatible so no code changes..."
- "ุฌุฑุจุช orgteh.com ูููุณ ุงูุบุฑุถุ API ู
ุชูุงูู ู
ุน OpenAI ููุดุชุบู ู
ุจุงุดุฑุฉ..."
- "ุนูุฏู ุชุฌุฑุจุฉ ู
ุน ูุฐุงุ ุงุณุชุฎุฏู
ุช orgteh.com ูููู ุนุฏุฉ ูู
ุงุฐุฌ ุจู endpoint ู
ูุญุฏ..."
"""
return ask_ai(prompt, temp=0.7)
def generate_email(company: str, snippet: str, audience: str | None = None) -> dict | None:
"""
ูููุฏ ุฅูู
ูู ุจุงุฑุฏ ู
ูุงุณุจ ูููุน ุงูุฌู
ููุฑ:
- api_developer โ ูุชุญุฏุซ ุนู AI API
- website_owner โ ูุชุญุฏุซ ุนู ุงูููุฏุฌูุช
"""
if audience == AUDIENCE_WIDGET:
prompt = f"""
You are a website owner who uses the Orgteh AI widget and want to recommend it to another business.
COMPANY/BUSINESS NAME: {company}
WHAT THEY DO: {snippet[:500]}
ABOUT THE WIDGET:
{SITE_CONTEXT}
Write a short personal email as a fellow website owner (not a sales rep).
- Detect language from the snippet and reply in THE SAME LANGUAGE. If Arabic content detected, write in Arabic.
- Subject: short and relevant to their business.
- Body: 3-5 sentences. Mention their specific business type. Explain the widget helps answer customer questions automatically by reading their website.
- Sound personal and helpful, not promotional.
- Include orgteh.com/widget naturally.
- Use "I" not "we".
Output STRICT JSON only:
{{"subject": "...", "body": "..."}}
"""
else:
prompt = f"""
You are a developer who uses Orgteh API and want to recommend it to another developer/startup.
COMPANY/DEV NAME: {company}
WHAT THEY DO: {snippet[:500]}
ABOUT ORGTEH:
{SITE_CONTEXT}
Write a short personal cold email as a fellow developer.
- Detect language from the snippet and reply in THE SAME LANGUAGE. If Arabic content detected, write in Arabic.
- Subject: short, specific to their use case.
- Body: 4-5 sentences. Reference what they do specifically.
- Sound like sharing a tool that helped you, not selling.
- Include orgteh.com naturally.
- Use "I" not "we".
Output STRICT JSON only:
{{"subject": "...", "body": "..."}}
"""
resp = ask_ai(prompt, temp=0.6)
if resp:
try:
m = re.search(r'\{.*\}', resp, re.DOTALL)
if m:
return json.loads(m.group(0))
except:
pass
return None
# ==========================================
# 6. ูุธุงู
ู
ุงูุน ุงูุญุธุฑ (Anti-Ban Engine)
# ==========================================
class AntiBan:
"""
ูุชุญูู
ูู ุชูููุช ุงูุฅุฑุณุงู ููู ู
ูุตุฉ ูุชุฌูุจ ุงูุญุธุฑ.
ูุณุชุฎุฏู
ุชุฃุฎูุฑุงุช ุนุดูุงุฆูุฉ ูุญุฏูุฏุงู ููู
ูุฉ ุตุงุฑู
ุฉ.
"""
def __init__(self):
self._day = datetime.utcnow().date()
self._counts = {k: 0 for k in LIMITS}
self._lock = threading.Lock()
def _reset_if_new_day(self):
today = datetime.utcnow().date()
if today != self._day:
self._day = today
self._counts = {k: 0 for k in LIMITS}
def can_act(self, platform: str) -> bool:
key = f"{platform}_daily"
with self._lock:
self._reset_if_new_day()
return self._counts.get(key, 0) < LIMITS.get(key, 999)
def record(self, platform: str):
key = f"{platform}_daily"
with self._lock:
self._counts[key] = self._counts.get(key, 0) + 1
LOCAL_STATS[platform] = LOCAL_STATS.get(platform, 0) + 1
# ุญูุธ ุงูุฅุญุตุงุฆูุงุช ูู Redis ูู 5 ุนู
ููุงุช
if sum(LOCAL_STATS.values()) % 5 == 0:
memory.save_stats(LOCAL_STATS)
@staticmethod
def human_delay(base=15, jitter=20):
"""ุชุฃุฎูุฑ ุนุดูุงุฆู ูุดุจู ุงูุณููู ุงูุจุดุฑู."""
delay = base + random.uniform(0, jitter)
time.sleep(delay)
@staticmethod
def micro_delay():
time.sleep(random.uniform(2, 6))
antiban = AntiBan()
# ==========================================
# 7. ู
ูุตุงุช ุงูุจุซ - GitHub (ู
ุน ููุชุฑ ุงูู
ุจุชุฏุฆูู)
# ==========================================
def github_loop():
headers = {"Authorization": f"token {GITHUB_TOKEN}", "Accept": "application/vnd.github.v3+json"}
while True:
try:
if not GITHUB_TOKEN:
log_activity("GitHub", "ู
ุนุทูู", "โ", note="GITHUB_TOKEN ู
ูููุฏ", level="error")
time.sleep(600)
continue
keywords = get_random_keywords(5)
for kw in keywords:
if not antiban.can_act("github"):
break
resp = requests.get(
f"https://api.github.com/search/issues"
f"?q={requests.utils.quote(kw)}+state:open+type:issue"
f"&sort=updated&per_page=10",
headers=headers, timeout=15
)
if resp.status_code != 200:
log_activity("GitHub", f"ุจุญุซ '{kw}'", "api.github.com",
note=f"HTTP {resp.status_code}", level="error")
if resp.status_code == 403:
time.sleep(300)
break
items = resp.json().get("items", [])
log_activity("GitHub", f"ุจุญุซ '{kw}'", "api.github.com",
found=len(items),
note=f"ูุฌุฏ {len(items)} issue", level="info")
matched = 0
skipped_seen = 0
skipped_ai = 0
skipped_repo = 0
for item in items:
if not antiban.can_act("github"):
break
url = item["html_url"]
body_text = (item.get("body") or "")
full_text = item["title"] + " " + body_text
repo_name = item.get("repository_url", "").split("/")[-2] + "/" + item.get("repository_url", "").split("/")[-1]
if memory.seen(url):
skipped_seen += 1
continue
user_id = f"gh:{item.get('user', {}).get('login', '')}"
if memory.user_seen(user_id):
skipped_seen += 1
continue
audience = ai_judge(full_text)
if not audience:
skipped_ai += 1
log_activity("GitHub", f"โญ ูููุชุฑ (ุบูุฑ ู
ุฑุชุจุท)", repo_name,
note=f"{item['title'][:70]}", level="info")
continue
if not ai_judge_github(full_text, repo=repo_name):
skipped_repo += 1
log_activity("GitHub", f"โญ ูููุชุฑ (ู
ุณุชูุฏุน ู
ุชูุฏู
)", repo_name,
note=f"{item['title'][:70]}", level="info")
continue
reply = generate_reply(full_text, "GitHub", audience)
if not reply:
log_activity("GitHub", "โ ๏ธ AI ูู
ูููุชุฌ ุฑุฏููุง", repo_name,
note="generate_reply ุฃุฑุฌุน None", level="warn")
continue
post = requests.post(
item["url"] + "/comments",
headers=headers,
json={"body": reply},
timeout=10
)
if post.status_code == 201:
comment_data = post.json()
comment_id = comment_data.get("id")
comment_url = comment_data.get("html_url", url)
memory.mark(url)
memory.mark_user(user_id)
memory.log("GitHub", item["title"], url, body_text, reply)
antiban.record("github")
matched += 1
log_activity("GitHub", f"โ
ุนููู ุนูู [{repo_name}]",
item["title"][:60], found=1,
note=f"ุฌู
ููุฑ: {audience} | ๐ {comment_url}", level="success")
if comment_id:
with _our_comments_lock:
_our_github_comments.append({
"repo_api": item["url"],
"comment_id": comment_id,
"title": item["title"][:80],
"url": url,
"ts": datetime.now().isoformat(),
})
if len(_our_github_comments) > 100:
_our_github_comments.pop()
antiban.human_delay(15, 15)
else:
log_activity("GitHub", f"โ ูุดู POST", repo_name,
note=f"HTTP {post.status_code} | {item['title'][:50]}", level="error")
# ู
ูุฎุต ููุงูุฉ ุงูุจุญุซ
log_activity("GitHub", f"ู
ูุฎุต '{kw}'", "api.github.com",
found=matched,
note=(f"โ
{matched} ุชุนููู | โญ {skipped_seen} ู
ูุฑุฑ "
f"| ๐ค {skipped_ai} ุบูุฑ ู
ุฑุชุจุท | ๐ {skipped_repo} ู
ุชูุฏู
"),
level="success" if matched > 0 else "warn")
time.sleep(random.randint(20, 40))
except Exception as e:
log_activity("GitHub", "ุฎุทุฃ", "โ", note=str(e)[:80], level="error")
print(f"GitHub Error: {e}")
time.sleep(300)
# ==========================================
# ==========================================
# 8. ู
ูุตุงุช ุงูุจุซ - Reddit (OAuth โ ุจุฏูู Playwright/Cookies)
# ==========================================
# ุงูู
ุชุทูุจุงุช ูู Secrets:
# REDDIT_CLIENT_ID โ ู
ู reddit.com/prefs/apps (Create App โ script)
# REDDIT_CLIENT_SECRET โ ููุณ ุงูุตูุญุฉ
# REDDIT_USERNAME โ ุงุณู
ู
ุณุชุฎุฏู
ุญุณุงุจ Reddit
# REDDIT_PASSWORD โ ููู
ุฉ ู
ุฑูุฑ ุงูุญุณุงุจ
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
SEED_SUBREDDITS = [
# ู
ุทูุฑู AI API
"LocalLLaMA", "MachineLearning", "ChatGPT", "OpenAI",
"learnmachinelearning", "ArtificialIntelligence", "SideProject",
"startups", "webdev", "learnprogramming", "Python",
"programming", "nocode", "AppDev", "reactjs", "fastapi",
"freelance", "entrepreneur",
# ุฃุตุญุงุจ ุงูู
ูุงูุน / ุฎุฏู
ุฉ ุงูุนู
ูุงุก
"ecommerce", "shopify", "woocommerce", "smallbusiness",
"customerservice", "SaaS", "Wordpress",
# ู
ุฌุชู
ุนุงุช ุนุฑุจูุฉ
"arabs", "saudiarabia", "algeria", "Morocco", "Egypt", "tunisia",
# ุฃุฎุฑู
"learnpython", "django", "flask",
]
_subs_cache = list(SEED_SUBREDDITS)
_subs_lock = threading.Lock()
_subs_refreshed: float = 0.0
SUBS_REFRESH_HRS = 6
# โโ Reddit OAuth token โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
_reddit_token: str = ""
_reddit_token_expiry: float = 0.0
_reddit_token_lock = threading.Lock()
_REDDIT_UA = "orgteh-bot/2.0 (by u/{user})"
def _reddit_get_token() -> str:
"""
ูุญุตู ุนูู Access Token ุจู Password Grant (script app).
ูุฌุฏุฏู ุชููุงุฆูุงู ูุจู ุงูุชูุงุฆู.
"""
global _reddit_token, _reddit_token_expiry
with _reddit_token_lock:
if _reddit_token and time.time() < _reddit_token_expiry:
return _reddit_token
if not all([REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET,
REDDIT_USERNAME, REDDIT_PASSWORD]):
return ""
try:
ua = _REDDIT_UA.format(user=REDDIT_USERNAME)
r = requests.post(
"https://www.reddit.com/api/v1/access_token",
auth=(REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET),
data={
"grant_type": "password",
"username": REDDIT_USERNAME,
"password": REDDIT_PASSWORD,
},
headers={"User-Agent": ua},
timeout=15,
)
if r.status_code == 200:
data = r.json()
if "error" in data:
log_activity("Reddit", "โ OAuth ูุดู", "reddit.com",
note=str(data["error"]), level="error")
return ""
_reddit_token = data.get("access_token", "")
expires_in = data.get("expires_in", 3600)
_reddit_token_expiry = time.time() + expires_in - 120
print(f"โ
Reddit OAuth OK (expires in {expires_in//60} ุฏูููุฉ)")
log_activity("Reddit", "โ
OAuth ูุฌุญ", "oauth.reddit.com",
note=f"Token ุตุงูุญ ูู {expires_in//60} ุฏูููุฉ",
level="success")
return _reddit_token
else:
log_activity("Reddit", "โ OAuth HTTP", "reddit.com",
note=f"HTTP {r.status_code}: {r.text[:80]}",
level="error")
except Exception as e:
log_activity("Reddit", "โ OAuth exception", "reddit.com",
note=str(e)[:80], level="error")
return ""
def _reddit_headers() -> dict | None:
"""ูุฑุฌุน headers ุฌุงูุฒุฉ ู
ุน Bearer Token."""
token = _reddit_get_token()
if not token:
return None
return {
"Authorization": f"Bearer {token}",
"User-Agent": _REDDIT_UA.format(user=REDDIT_USERNAME),
"Accept": "application/json",
}
def _ai_discover_subreddits() -> list:
"""ุงููู
ูุฐุฌ ููุชุฑุญ ุณุงุจุฑูุฏุชุงุช."""
prompt = """We market two products:
1. Orgteh AI API โ cheap OpenAI-compatible API for developers
2. Orgteh Widget โ AI chatbot widget for website owners (customer service)
List 40 active subreddit names (no r/) for BOTH audiences:
- Developers needing LLM/AI API integration help
- Website/business owners wanting automated customer support
Output JSON array only: ["sub1","sub2",...]"""
resp = ask_ai(prompt, temp=0.7)
found = []
if resp:
try:
m = re.search(r"\[.*?\]", resp, re.DOTALL)
if m:
for s in json.loads(m.group(0)):
s = str(s).strip().lstrip("r/")
if s and len(s) <= 30:
found.append(s)
except Exception:
pass
return found[:40]
def _refresh_subreddits():
global _subs_cache, _subs_refreshed
if time.time() - _subs_refreshed < SUBS_REFRESH_HRS * 3600:
return
with _subs_lock:
new = _ai_discover_subreddits()
_subs_cache = list(set(SEED_SUBREDDITS + new))
_subs_refreshed = time.time()
print(f"โ
Reddit subreddits: {len(_subs_cache)} ุฅุฌู
ุงูุงู")
def _get_subs(n: int = 3) -> list:
with _subs_lock:
pool = _subs_cache or SEED_SUBREDDITS
return random.sample(pool, min(n, len(pool)))
def _reddit_search(sub: str, kw: str, limit: int = 10) -> list:
"""ูุจุญุซ ูู ุณุงุจุฑูุฏุช ุจุงุณุชุฎุฏุงู
OAuth API."""
hdrs = _reddit_headers()
if not hdrs:
# fallback: ุงููุฑุงุกุฉ ุงูุนุงู
ุฉ ุจุฏูู token (ูููุฑุงุกุฉ ููุท)
hdrs = {"User-Agent": "orgteh-reader/1.0"}
url = f"https://www.reddit.com/r/{sub}/search.json"
else:
url = f"https://oauth.reddit.com/r/{sub}/search"
try:
r = requests.get(
url,
params={"q": kw, "sort": "new", "restrict_sr": 1,
"limit": limit, "type": "link"},
headers=hdrs,
timeout=12,
)
if r.status_code == 401:
# Token ู
ูุชูู โ ููุนูุฏ ุงูุชูุซูู
global _reddit_token
_reddit_token = ""
log_activity("Reddit", "โ ๏ธ Token ุงูุชูู", f"r/{sub}",
note="ููุนูุฏ ุงูุชูุซูู...", level="warn")
return []
if r.status_code == 429:
log_activity("Reddit", "โณ Rate limit", f"r/{sub}",
note="ููุชุธุฑ 60 ุซุงููุฉ", level="warn")
time.sleep(60)
return []
if r.status_code != 200:
log_activity("Reddit", f"โ HTTP {r.status_code}", f"r/{sub}",
note=r.text[:80], level="error")
return []
children = r.json().get("data", {}).get("children", [])
posts = [c["data"] for c in children if c.get("kind") == "t3"]
log_activity("Reddit", f"ุจุญุซ r/{sub} '{kw}'", f"reddit.com/r/{sub}",
found=len(posts),
note=f"ูุฌุฏ {len(posts)} ู
ูุดูุฑ", level="info")
return posts
except Exception as e:
log_activity("Reddit", f"โ ุฎุทุฃ r/{sub}", f"r/{sub}",
note=str(e)[:80], level="error")
return []
def _reddit_comment(post_fullname: str, text: str) -> bool:
"""ูุถูู ุชุนูููุงู ุจุงุณุชุฎุฏุงู
OAuth API."""
hdrs = _reddit_headers()
if not hdrs:
log_activity("Reddit", "โ ูุง token ููุชุนููู", "oauth.reddit.com",
note="ุชุญูู ู
ู REDDIT_CLIENT_ID/SECRET/USERNAME/PASSWORD",
level="error")
return False
try:
r = requests.post(
"https://oauth.reddit.com/api/comment",
headers=hdrs,
data={"api_type": "json", "thing_id": post_fullname, "text": text},
timeout=15,
)
if r.status_code == 200:
errs = r.json().get("json", {}).get("errors", [])
if not errs:
return True
log_activity("Reddit", "โ ุฃุฎุทุงุก API", "oauth.reddit.com",
note=str(errs)[:100], level="error")
elif r.status_code == 403:
log_activity("Reddit", "โ 403 ู
ุญุธูุฑ", "oauth.reddit.com",
note="ุงูุญุณุงุจ ู
ุญุธูุฑ ู
ู ุงูุชุนููู ุฃู ุตูุงุญูุงุช ูุงูุตุฉ",
level="error")
else:
log_activity("Reddit", f"โ HTTP {r.status_code}", "oauth.reddit.com",
note=r.text[:80], level="error")
except Exception as e:
log_activity("Reddit", "โ exception ูู ุงูุชุนููู", "oauth.reddit.com",
note=str(e)[:80], level="error")
return False
def reddit_loop():
"""
ูุจุญุซ ูู ุงูุณุงุจุฑูุฏุชุงุช ููุนูู ุจุงุณุชุฎุฏุงู
Reddit OAuth.
ูุนู
ู ุจุฏูู Playwright ุฃู Cookies.
"""
# ุชุญูู ู
ู ูุฌูุฏ ุงูู
ุชุบูุฑุงุช
if not all([REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET,
REDDIT_USERNAME, REDDIT_PASSWORD]):
missing = [k for k, v in {
"REDDIT_CLIENT_ID": REDDIT_CLIENT_ID,
"REDDIT_CLIENT_SECRET": REDDIT_CLIENT_SECRET,
"REDDIT_USERNAME": REDDIT_USERNAME,
"REDDIT_PASSWORD": REDDIT_PASSWORD,
}.items() if not v]
log_activity("Reddit", "ู
ุนุทูู", "โ",
note=f"ู
ูุงุชูุญ ู
ูููุฏุฉ: {', '.join(missing)}", level="error")
print(f"โ Reddit: ู
ูุงุชูุญ ู
ูููุฏุฉ: {missing}")
print(" ุฃุถููุง ูู HuggingFace Secrets โ ุฑุงุฌุน reddit.com/prefs/apps")
return
# ุงุฎุชุจุงุฑ OAuth ููุฑุงู
token = _reddit_get_token()
if not token:
print("โ Reddit: OAuth ูุดู โ ุชุญูู ู
ู ุงูู
ูุงุชูุญ")
return
print(f"โ
Reddit: OAuth ุฌุงูุฒ โ u/{REDDIT_USERNAME}")
_refresh_subreddits()
cycle_r = 0
while True:
try:
_refresh_subreddits()
if not antiban.can_act("reddit"):
log_activity("Reddit", "โธ ุงูุญุฏ ุงูููู
ู", "โ",
note=f"{LOCAL_STATS.get('reddit',0)}/{LIMITS['reddit_daily']}",
level="warn")
time.sleep(600)
continue
cycle_r += 1
subs = _get_subs(3)
kws = get_random_keywords(3)
print(f"\n๐ค Reddit ุฏูุฑุฉ #{cycle_r} | {subs} | {kws}")
for sub, kw in zip(subs, kws):
if not antiban.can_act("reddit"):
break
posts = _reddit_search(sub, kw, limit=8)
if not posts:
continue
matched_r = 0
skipped_seen = 0
skipped_ai = 0
for post in posts:
if not antiban.can_act("reddit"):
break
post_url = f"https://reddit.com{post.get('permalink','')}"
post_id = post.get("name", "")
author = post.get("author", "")
user_id = f"rd:{author}"
full_text = post.get("title","") + " " + (post.get("selftext") or "")
if not post_id or not author or author in ("[deleted]", "AutoModerator"):
continue
if memory.seen(post_url) or memory.user_seen(user_id):
skipped_seen += 1
continue
audience = ai_judge(full_text)
if not audience:
skipped_ai += 1
log_activity("Reddit", f"โญ ูููุชุฑ r/{sub}",
post.get("title","")[:70],
note="ุบูุฑ ู
ุฑุชุจุท ุจู
ูุชุฌุงุชูุง", level="info")
continue
reply = generate_reply(full_text, "Reddit", audience)
if not reply:
log_activity("Reddit", "โ ๏ธ AI ูู
ูููุชุฌ ุฑุฏููุง",
post.get("title","")[:60],
note="generate_reply ุฃุฑุฌุน None", level="warn")
continue
ok = _reddit_comment(post_id, reply)
if ok:
memory.mark(post_url)
memory.mark_user(user_id)
memory.log("Reddit", post.get("title",""), post_url,
full_text[:300], reply)
antiban.record("reddit")
matched_r += 1
log_activity("Reddit", f"โ
ุชุนููู r/{sub}",
post.get("title","")[:70],
found=1,
note=f"ุฌู
ููุฑ: {audience} | ๐ {post_url}",
level="success")
with _our_comments_lock:
_our_reddit_comments.append({
"post_url": post_url,
"post_id": post_id,
"sub": sub,
"title": post.get("title","")[:80],
"ts": datetime.now().isoformat(),
})
if len(_our_reddit_comments) > 100:
_our_reddit_comments.pop()
antiban.human_delay(90, 90)
break
else:
log_activity("Reddit", f"โ ูุดู ุงูุชุนููู r/{sub}",
post.get("title","")[:70],
note="ุฑุงุฌุน ุณุฌู ุงูุฃุฎุทุงุก ุฃุนูุงู", level="error")
log_activity("Reddit", f"ู
ูุฎุต r/{sub} '{kw}'",
f"reddit.com/r/{sub}", found=matched_r,
note=(f"โ
{matched_r} ุชุนููู | โญ {skipped_seen} ู
ูุฑุฑ "
f"| ๐ค {skipped_ai} ุบูุฑ ู
ุฑุชุจุท"),
level="success" if matched_r > 0 else "warn")
except Exception as e:
log_activity("Reddit", "ุฎุทุฃ ูู ุงูุญููุฉ", "โ",
note=str(e)[:80], level="error")
print(f"Reddit loop error: {e}")
time.sleep(random.randint(400, 700))
# ==========================================
SO_API_KEY = os.getenv("STACKOVERFLOW_API_KEY", "") # ุงุฎุชูุงุฑู โ ูุฑูุน ุงูุญุฏ ู
ู 300 ูู 10000/ููู
def stackoverflow_loop():
"""
Stack Overflow API โ ูุฌูุจ ุนูู ุงูุฃุณุฆูุฉ ุงูู
ุชุนููุฉ ุจู AI API.
ูุณุชุฎุฏู
/answers endpoint ูุฅุถุงูุฉ ุฅุฌุงุจุงุช ุนูู ุงูุฃุณุฆูุฉ ุงูู
ูุชูุญุฉ.
"""
base_search = "https://api.stackexchange.com/2.3/search/advanced"
base_answer = "https://api.stackexchange.com/2.3/questions/{}/answers"
base_post = "https://api.stackexchange.com/2.3/answers/add" # ูุชุทูุจ OAuth
while True:
try:
if not antiban.can_act("stackoverflow"):
time.sleep(600)
continue
kw = random.choice(get_random_keywords(1))
print(f"๐ StackOverflow: ูุจุญุซ ุจู '{kw}'")
params = {
"q": kw, "site": "stackoverflow",
"sort": "creation", "order": "desc",
"pagesize": 10, "filter": "withbody",
"tagged": "python;artificial-intelligence;openai-api",
"nottagged": "answered",
}
if SO_API_KEY:
params["key"] = SO_API_KEY
resp = requests.get(base_search, params=params, timeout=15)
if resp.status_code != 200:
log_activity("StackOverflow", f"ุจุญุซ '{kw}'", "stackoverflow.com",
note=f"HTTP {resp.status_code}", level="error")
time.sleep(300)
continue
items = resp.json().get("items", [])
if items:
log_activity("StackOverflow", f"ุจุญุซ '{kw}'", "stackoverflow.com",
found=len(items), note=f"ูุฌุฏ {len(items)} ุณุคุงู", level="info")
else:
log_activity("StackOverflow", f"ุจุญุซ '{kw}'", "stackoverflow.com",
found=0, note="ูุง ุฃุณุฆูุฉ ู
ูุชูุญุฉ", level="warn")
for q in items:
if not antiban.can_act("stackoverflow"):
break
q_id = q.get("question_id")
url = q.get("link", "")
owner = q.get("owner", {})
user_id = f"so:{owner.get('user_id','')}"
title = q.get("title", "")
body = re.sub(r"<[^>]+>", " ", q.get("body", ""))
full_text = title + " " + body
if memory.seen(url) or memory.user_seen(user_id):
print(f" โญ SO skip (seen): {title[:45]}")
continue
audience = ai_judge(full_text)
if not audience:
print(f" โญ SO skip (not relevant): {title[:45]}")
continue
print(f" โ
SO match [{audience}]: {title[:45]}")
reply = generate_reply(full_text, "Stack Overflow", audience)
if not reply:
continue
memory.mark(url)
memory.mark_user(user_id)
memory.log("StackOverflow", title, url, body[:300], reply)
antiban.record("stackoverflow")
log_activity("StackOverflow", "ุฅุฌุงุจุฉ", title[:70],
found=1, note=f"ุฌู
ููุฑ: {audience}", level="success")
print(f" โ
โ
SO logged: {title[:45]}")
antiban.micro_delay()
except Exception as e:
print(f"SO Error: {e}")
time.sleep(random.randint(120, 240))
# ==========================================
# 9b. ู
ูุตุงุช ุงูุจุซ - ProductHunt (ุชุนูููุงุช ุนูู ุงูู
ูุชุฌุงุช ุงูุฌุฏูุฏุฉ)
# ==========================================
# ProductHunt โ API Key + Secret ู
ุจุงุดุฑุฉ (ูุญุตู ุนูู Token ุชููุงุฆูุงู)
PH_API_KEY = os.getenv("PRODUCTHUNT_API_KEY", "")
PH_API_SECRET = os.getenv("PRODUCTHUNT_API_SECRET", "")
_ph_token: str = ""
_ph_token_expiry: float = 0.0
_ph_token_lock = threading.Lock()
def _ph_get_token() -> str:
"""
ูุญุตู ุนูู Access Token ุชููุงุฆูุงู ู
ู API Key + Secret.
ูุฌุฏุฏู ุนูุฏ ุงูุชูุงุฆู โ ูุง ุฎุทูุงุช ูุฏููุฉ.
"""
global _ph_token, _ph_token_expiry
with _ph_token_lock:
if _ph_token and time.time() < _ph_token_expiry:
return _ph_token
if not PH_API_KEY or not PH_API_SECRET:
return ""
try:
r = requests.post(
"https://api.producthunt.com/v2/oauth/token",
json={
"client_id": PH_API_KEY,
"client_secret": PH_API_SECRET,
"grant_type": "client_credentials",
},
timeout=15,
)
if r.status_code == 200:
data = r.json()
_ph_token = data.get("access_token", "")
expires_in = data.get("expires_in", 7200)
_ph_token_expiry = time.time() + expires_in - 120
print(f"โ
ProductHunt token OK (expires in {expires_in//3600}h)")
return _ph_token
else:
print(f"ProductHunt token error: {r.status_code} {r.text[:100]}")
except Exception as e:
print(f"ProductHunt token error: {e}")
return ""
def producthunt_loop():
"""ูุนูู ุนูู ุงูู
ูุชุฌุงุช ุงูุฌุฏูุฏุฉ ูู ProductHunt."""
gql_url = "https://api.producthunt.com/v2/api/graphql"
query = """
{
posts(first: 20, order: NEWEST, topic: "artificial-intelligence") {
edges {
node {
id name tagline description url votesCount
user { username }
}
}
}
}
"""
while True:
try:
if not antiban.can_act("producthunt"):
time.sleep(1800)
continue
token = _ph_get_token()
if not token:
log_activity("ProductHunt", "ู
ุนุทูู", "โ",
note="ุชุญูู ู
ู PRODUCTHUNT_API_KEY/SECRET", level="error")
time.sleep(3600)
continue
# ู
ูุงุญุธุฉ: ProductHunt API ุจู client_credentials ูุง ูุฏุนู
ูุดุฑ ุงูุชุนูููุงุช
# ูุญุชุงุฌ user-level OAuth โ ุณูุณุชุฎุฏู
PH ูููุฑุงุกุฉ ูุงูุชุณุฌูู ููุท ุญุงููุงู
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
}
resp = requests.post(gql_url, json={"query": query}, headers=headers, timeout=15)
if resp.status_code != 200:
log_activity("ProductHunt", "ุฌูุจ ู
ูุชุฌุงุช", "producthunt.com",
note=f"HTTP {resp.status_code}", level="error")
time.sleep(600)
continue
posts = resp.json().get("data", {}).get("posts", {}).get("edges", [])
log_activity("ProductHunt", "ุฌูุจ ู
ูุชุฌุงุช AI", "producthunt.com",
found=len(posts), note=f"{len(posts)} ู
ูุชุฌ ุฌุฏูุฏ", level="info")
matched_ph = 0
skipped_seen_ph = 0
skipped_ai_ph = 0
for edge in posts:
if not antiban.can_act("producthunt"):
break
node = edge["node"]
url = node.get("url", "")
post_id = node.get("id", "")
name = node.get("name","")
user_id = f"ph:{node.get('user',{}).get('username','')}"
full_text = (name + " " + node.get("tagline","") + " " +
(node.get("description") or ""))
if memory.seen(url) or memory.user_seen(user_id):
skipped_seen_ph += 1
continue
audience = ai_judge(full_text)
if not audience:
skipped_ai_ph += 1
log_activity("ProductHunt", f"โญ ูููุชุฑ",
name[:70], note="ุบูุฑ ู
ุฑุชุจุท ุจู
ูุชุฌุงุชูุง", level="info")
continue
print(f" โ
PH match [{audience}]: {name[:40]}")
reply = generate_reply(full_text, "ProductHunt", audience)
if not reply:
continue
safe_reply = reply.replace('"', "'").replace("\n", " ")
mutation = (
'mutation { createComment(input: {' +
f'postId: "{post_id}" body: "{safe_reply}"' +
'}) { comment { id } errors { field message } } }'
)
post_resp = requests.post(
gql_url, json={"query": mutation},
headers=headers, timeout=10
)
if post_resp.status_code == 200:
resp_data = post_resp.json()
errs = resp_data.get("errors", [])
inner_errs = (resp_data.get("data",{})
.get("createComment",{})
.get("errors",[]))
all_errs = errs + inner_errs
if not all_errs:
memory.mark(url)
memory.mark_user(user_id)
memory.log("ProductHunt", name, url, full_text[:300], reply)
antiban.record("producthunt")
matched_ph += 1
log_activity("ProductHunt", f"โ
ุชุนููู ุนูู ู
ูุชุฌ",
name[:60], found=1,
note=f"ุฌู
ููุฑ: {audience} | ๐ {url}", level="success")
print(f"โ
ProductHunt: {name[:50]}")
antiban.human_delay(60, 60)
else:
log_activity("ProductHunt", f"โ ุฃุฎุทุงุก GraphQL",
name[:60],
note=str(all_errs)[:120], level="error")
else:
log_activity("ProductHunt", f"โ ูุดู POST",
name[:60],
note=f"HTTP {post_resp.status_code}", level="error")
log_activity("ProductHunt", "ู
ูุฎุต ุงูุฏูุฑุฉ", "producthunt.com",
found=matched_ph,
note=(f"โ
{matched_ph} ุชุนููู | โญ {skipped_seen_ph} ู
ูุฑุฑ "
f"| ๐ค {skipped_ai_ph} ุบูุฑ ู
ุฑุชุจุท"),
level="success" if matched_ph > 0 else "warn")
except Exception as e:
log_activity("ProductHunt", "ุฎุทุฃ", "โ", note=str(e)[:80], level="error")
print(f"ProductHunt Error: {e}")
time.sleep(random.randint(600, 900))
# ==========================================
# 10. ู
ูุตุงุช ุงูุจุซ - Dev.to
# ==========================================
def devto_loop():
"""Dev.to API - ุงูุชุนููู ุนูู ู
ูุงูุงุช ุงูู
ุทูุฑูู."""
headers = {"api-key": DEVTO_API_KEY or "", "Content-Type": "application/json"}
while True:
try:
if not DEVTO_API_KEY:
log_activity("Dev.to", "ู
ุนุทูู", "โ", note="DEVTO_API_KEY ู
ูููุฏ", level="error")
time.sleep(1800)
continue
if not antiban.can_act("devto"):
time.sleep(1800)
continue
for tag in ["api", "llm", "openai", "chatbot", "artificialintelligence"]:
resp = requests.get(
f"https://dev.to/api/articles?tag={tag}&top=1&per_page=5",
timeout=10
)
if resp.status_code != 200:
log_activity("Dev.to", f"ุจุญุซ #{tag}", "dev.to",
note=f"HTTP {resp.status_code}", level="error")
continue
articles = resp.json()
log_activity("Dev.to", f"ุจุญุซ #{tag}", "dev.to",
found=len(articles),
note=f"ูุฌุฏ {len(articles)} ู
ูุงูุฉ", level="info")
matched_dt = 0
skipped_seen_dt = 0
skipped_ai_dt = 0
for article in articles:
title_a = article.get("title","")
full_text = title_a + " " + (article.get("description") or "")
url = article.get("url","")
user_id = f"devto:{article.get('user',{}).get('username','')}"
if not url or memory.seen(url) or memory.user_seen(user_id):
skipped_seen_dt += 1
continue
audience = ai_judge(full_text)
if not audience:
skipped_ai_dt += 1
log_activity("Dev.to", f"โญ ูููุชุฑ #{tag}",
title_a[:70], note="ุบูุฑ ู
ุฑุชุจุท ุจู
ูุชุฌุงุชูุง", level="info")
continue
print(f" โ
Dev.to match [{audience}]: {title_a[:45]}")
reply = generate_reply(full_text, "Dev.to", audience)
if not reply:
log_activity("Dev.to", "โ ๏ธ AI ูู
ูููุชุฌ ุฑุฏููุง", title_a[:60],
note="generate_reply ุฃุฑุฌุน None โ NVIDIA API ู
ุดุบููุ",
level="warn")
continue
post = requests.post(
"https://dev.to/api/comments",
headers=headers,
json={"body_markdown": reply, "article_id": article["id"]},
timeout=10
)
if post.status_code in (200, 201):
memory.mark(url)
memory.mark_user(user_id)
memory.log("Dev.to", title_a, url, full_text, reply)
antiban.record("devto")
matched_dt += 1
log_activity("Dev.to", f"โ
ุชุนููู #{tag}",
title_a[:60], found=1,
note=f"ุฌู
ููุฑ: {audience} | ๐ {url}", level="success")
print(f"โ
Dev.to: {title_a[:50]}")
antiban.human_delay(90, 90)
break
else:
log_activity("Dev.to", f"โ ูุดู POST #{tag}",
title_a[:60],
note=f"HTTP {post.status_code} | {post.text[:100]}",
level="error")
log_activity("Dev.to", f"ู
ูุฎุต #{tag}", "dev.to",
found=matched_dt,
note=(f"โ
{matched_dt} ุชุนููู | โญ {skipped_seen_dt} ู
ูุฑุฑ "
f"| ๐ค {skipped_ai_dt} ุบูุฑ ู
ุฑุชุจุท"),
level="success" if matched_dt > 0 else "warn")
except Exception as e:
log_activity("Dev.to", "ุฎุทุฃ", "โ", note=str(e)[:80], level="error")
print(f"Dev.to Error: {e}")
time.sleep(random.randint(1800, 2700))
# ==========================================
# 11. Discord โ ู
ุนุทูู (HuggingFace ูุญุฌุจ discord.com)
# ==========================================
# HuggingFace Spaces ุชุญุฌุจ discord.com ุนูู ู
ุณุชูู DNS.
# ูุชูุนูู Discord: ุดุบูู discord_worker.py ุนูู Railway (ู
ูู ู
ููุตู).
# ูู ุงูููุช ุงูุญุงูู ูุฐุง ุงูุฎูุท ูุง ูุนู
ู ูููุณุฌูู ุณุจุจ ุงูุชุนุทูู ููุท.
DC_SEED_GUILDS = [
"1050422060328587374", # Hugging Face
"879548962464493619", # LangChain
"1038516858214187058", # OpenAI Community
"974519864045756446", # AI/ML
"822462215499587604", # Python Discord
"267624335836053506", # Programming
"889872606868959273", # Indie Hackers
"1009953904836329512", # ู
ุทูุฑูู ุนุฑุจ
]
def discord_monitor_loop():
"""
ู
ุนุทูู โ HuggingFace ูุญุฌุจ discord.com ุนูู ู
ุณุชูู DNS.
ููุณุฌูู ุฑุณุงูุฉ ูุงุถุญุฉ ููุฎุฑุฌ ุฏูู ุฅูุฏุงุฑ ู
ูุงุฑุฏ.
"""
log_activity("Discord", "โ ู
ุญุฌูุจ ุนูู HuggingFace", "discord.com",
note="HuggingFace ูุญุฌุจ discord.com โ ูุง ุญู ูู ู
ูู ูุงุญุฏ",
level="error")
print("โ Discord: ู
ุญุฌูุจ ุนูู HuggingFace Spaces โ ุงูุฎูุท ู
ุชููู")
# ูุง while loop โ ูุง ู
ูุงุฑุฏ ู
ูุฏุฑุฉ
# ==========================================
# โโ ุชุฏูุฆุฉ ุชุฏุฑูุฌูุฉ (Warm-up): ูู ุฃูู ุฃูุงู
ุงูุชุดุบูู ูุฑุณู ุฃูู โโ
# ุงูููู
1: 200 | ุงูููู
3: 500 | ุงูููู
7: 1500 | ุงูููู
14+: 5000
_BOOT_TIME = datetime.utcnow()
def _email_daily_cap() -> int:
"""ูุฒูุฏ ุงูุญุฏ ุชุฏุฑูุฌูุงู ุจุฏูุงู ู
ู ุงูููุฒ ูู 5000 ูุฌุฃุฉ."""
days = (datetime.utcnow() - _BOOT_TIME).days
if days < 1: return 200
if days < 3: return 500
if days < 7: return 1500
if days < 14: return 3000
return 5000
# โโ ูุงุฆู
ุฉ ุงูุชุธุงุฑ ุงูุฅุฑุณุงู (ูุชูุฒูุน ุงูุฅูู
ููุงุช ุนูู ุงูููู
ููู) โโ
_email_queue: list[dict] = []
_email_queue_lock = threading.Lock()
# โโ ุฃููุงุช ุงูุฅุฑุณุงู ุงูุจุดุฑูุฉ (ูุชุฌูุจ ู
ูุชุตู ุงูููู ูุฃููุงุช ุงูุฐุฑูุฉ ุงูู
ุดุจููุฉ) โโ
# ูุฑุณู ุนูู ู
ุฏุงุฑ ุงูุณุงุนุฉ โ HuggingFace ูุนู
ู 24/7
# (ุงูููุฏ ุงูุฒู
ูู ูุงู ูู
ูุน ุงูุฅุฑุณุงู ุณุงุนุงุช 23-7 UTC ุฃู ุณุงุนุงุช ุงูููุงุฑ ูู ุงูุดุฑู ุงูุฃูุณุท)
SEND_HOURS = list(range(0, 24)) # 24/7
def _in_send_window() -> bool:
return True # ุฅุฑุณุงู ุนูู ู
ุฏุงุฑ ุงูุณุงุนุฉ
def _build_email_message(from_name: str, to: str, subject: str, body: str) -> MIMEMultipart:
"""ูุจูู ุฑุณุงูุฉ ุฅูู
ูู ุงุญุชุฑุงููุฉ ุชุชุฌูุจ ู
ุฑุดุญุงุช Spam."""
msg = MIMEMultipart("alternative")
# From ุจุตูุบุฉ ุงุณู
+ ุฅูู
ูู ูุฒูุงุฏุฉ ุงูุซูุฉ
msg["From"] = formataddr((from_name, SMTP_EMAIL))
msg["To"] = to
msg["Subject"] = subject
msg["Message-ID"] = make_msgid(domain=SMTP_EMAIL.split("@")[-1])
msg["Date"] = datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S +0000")
# ูุต ุนุงุฏู ููุท (plain text ุฃูู ุงุญุชู
ุงูุงู ููู Spam ู
ู HTML)
msg.attach(MIMEText(body, "plain", "utf-8"))
return msg
def send_email(to: str, subject: str, body: str, sender_name: str = "Ahmed") -> tuple[bool, str]:
"""
ูุฑุณู ุฅูู
ูู ู
ุน:
- ุงุณู
ู
ุฑุณู ุจุดุฑู
- Message-ID ูุฑูุฏ
- ุชุฃุฎูุฑ ุนุดูุงุฆู ูุจู ุงูุฅุฑุณุงู
- ุฅุนุงุฏุฉ ุงูู
ุญุงููุฉ ู
ุฑุฉ ูุงุญุฏุฉ ุนูุฏ ุงููุดู
"""
if not SMTP_EMAIL or not SMTP_PASSWORD:
return False, "SMTP ุบูุฑ ู
ููุฃ"
if not _in_send_window():
return False, "ุฎุงุฑุฌ ูุงูุฐุฉ ุงูุฅุฑุณุงู"
msg = _build_email_message(sender_name, to, subject, body)
for attempt in range(2):
try:
srv = smtplib.SMTP(SMTP_SERVER, SMTP_PORT, timeout=30)
srv.ehlo()
srv.starttls()
srv.ehlo()
srv.login(SMTP_EMAIL, SMTP_PASSWORD)
srv.sendmail(SMTP_EMAIL, [to], msg.as_string())
srv.quit()
return True, "ุชู
ุงูุฅุฑุณุงู"
except smtplib.SMTPRecipientsRefused:
return False, "ุฅูู
ูู ู
ุฑููุถ"
except smtplib.SMTPDataError as e:
return False, f"ุฎุทุฃ ุจูุงูุงุช: {e}"
except Exception as e:
if attempt == 0:
time.sleep(random.uniform(5, 15))
else:
return False, str(e)
return False, "ูุดู ุจุนุฏ ุงูู
ุญุงููุงุช"
def test_smtp_connection() -> tuple[bool, str]:
"""ูุฎุชุจุฑ ุงุชุตุงู SMTP ูููุนูุฏ (ูุฌุงุญ, ุฑุณุงูุฉ)."""
if not SMTP_EMAIL or not SMTP_PASSWORD:
return False, "SMTP_EMAIL ุฃู SMTP_PASSWORD ู
ูููุฏ"
try:
srv = smtplib.SMTP(SMTP_SERVER, SMTP_PORT, timeout=15)
srv.ehlo()
srv.starttls()
srv.ehlo()
srv.login(SMTP_EMAIL, SMTP_PASSWORD)
srv.quit()
return True, f"โ
SMTP ู
ุชุตู: {SMTP_SERVER}:{SMTP_PORT} ({SMTP_EMAIL})"
except smtplib.SMTPAuthenticationError:
return False, f"โ ุฎุทุฃ ูู ููู
ุฉ ุงูู
ุฑูุฑ โ ุชุญูู ู
ู SMTP_PASSWORD"
except smtplib.SMTPConnectError as e:
return False, f"โ ูุง ูู
ูู ุงูุงุชุตุงู ุจู {SMTP_SERVER}:{SMTP_PORT} โ {e}"
except Exception as e:
return False, f"โ {type(e).__name__}: {str(e)[:80]}"
# โโ ู
ูููุฏ ุฃุณู
ุงุก ุงูู
ุฑุณู ุงูุนุดูุงุฆูุฉ ูุชุจุฏู ุจุดุฑูุฉ โโ
SENDER_NAMES = [
"Ahmed", "Omar", "Sara", "Youssef", "Layla",
"Alex", "Chris", "Maria", "James", "Anna",
]
def _random_sender() -> str:
return random.choice(SENDER_NAMES)
# ุงุณุชุฑุงุชูุฌูุงุช ุงูุจุญุซ ุนู ุงูุฅูู
ููุงุช ูุงูุดุฑูุงุช ุงููุงุดุฆุฉ
EMAIL_SEARCH_QUERIES = [
# โโโโ ุฌู
ููุฑ 1: ู
ุทูุฑู AI API โโโโ
"site:github.io ai api project contact email",
"site:github.com llm api integration project contact",
'"llm api" developer project contact email',
'"ai api" developer "contact" OR "email" site:github.com',
'"how to use llm api" developer email',
'"integrate ai model" project developer contact',
"site:producthunt.com ai chatbot api developer 2024",
"startup ai api integration developer email contact",
"site:indie.hackers.com ai api llm project",
'"building with llm" developer email contact',
'"llm api" OR "ai api" developer startup email contact',
'"chat completions" developer project contact email',
# โโโโ ุฌู
ููุฑ 2: ุฃุตุญุงุจ ุงูู
ูุงูุน โ ููุฏุฌูุช / ุฎุฏู
ุฉ ุนู
ูุงุก โโโโ
# EN
'"customer service chatbot" small business contact',
'"add chatbot to website" owner contact email',
'"automated customer support" website owner email',
"ecommerce store chatbot customer service contact",
'"website chatbot" business owner contact',
"shopify store owner customer support automation email",
"woocommerce site owner chatbot email contact",
"saas product owner customer support chatbot",
# AR โ ุฃุตุญุงุจ ุงูู
ูุงูุน ุงูุนุฑุจ (ุฃููููุฉ)
"ู
ููุน ุนุฑุจู ุฎุฏู
ุฉ ุนู
ูุงุก ุดุงุช ุจูุช",
"ู
ุชุฌุฑ ุงููุชุฑููู ุนุฑุจู ุฏุนู
ุนู
ูุงุก ุชููุงุฆู",
"ุตุงุญุจ ู
ููุน ุนุฑุจู ููุฏุฌูุช",
"ุดุงุช ุจูุช ููู
ุชุฌุฑ ุงูุฅููุชุฑููู ุงูุนุฑุจู",
"site:salla.sa chatbot ุฎุฏู
ุฉ ุนู
ูุงุก",
"site:zid.sa ุฑูุจูุช ู
ุญุงุฏุซุฉ",
"ู
ุชุงุฌุฑ ุณูุฉ ููุฏุฌูุช ุฎุฏู
ุฉ ุนู
ูุงุก",
# ู
ุชุงุฌุฑ ูู
ูุงูุน ูุงุดุฆุฉ
"site:indie.hackers.com customer support chatbot website",
"site:producthunt.com customer service ai widget",
'"customer support" "website" owner email contact startup',
]
# โโ ูุธุงู
ุฅูู
ูู ู
ูุซูู: ูุตู ุงูุจุญุซ ุนู ุงูุฅุฑุณุงู โโ
# ุงูุจุญุซ ูู
ูุฃ _email_queueุ ูุงูุฅุฑุณุงู ูููุฑูุบู ุจุฅููุงุน ุจุดุฑู
# Headers ุชุดุจู ุงูู
ุชุตูุญ ูุชุฌูุจ ุงูุญุธุฑ
_EMAIL_HEADERS = {
"User-Agent": (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/122.0.0.0 Safari/537.36"
),
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "en-US,en;q=0.9,ar;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
"DNT": "1",
"Connection": "keep-alive",
}
_SKIP_DOMAINS = [
"facebook.com","linkedin.com","twitter.com","x.com","youtube.com",
"instagram.com","tiktok.com","reddit.com","google.com","amazon.com",
"wikipedia.org","github.com","stackoverflow.com",
]
def _web_search(query: str, max_results: int = 8) -> list:
"""
ูุจุญุซ ูู ู
ุญุฑูุงุช ุจุญุซ ู
ุชุนุฏุฏุฉ ุจุงูุชุฑุชูุจ ุญุชู ูุญุตู ุนูู ูุชุงุฆุฌ.
ุงูู
ุญุฑูุงุช: Bing (ุงูุฃู
ูุซู ุนูู HuggingFace) โ DDG โ Common Crawl Index.
"""
results = _bing_search(query, max_results)
if results:
return results
results = _ddg_search(query, max_results)
if results:
return results
# ุขุฎุฑ ุฎูุงุฑ: ุงุจุญุซ ู
ุจุงุดุฑุฉ ูู GitHub ูdev.to ูindie hackers
results = _direct_source_search(query, max_results)
return results
def _bing_search(query: str, max_results: int = 8) -> list:
"""
Bing HTML search โ ูุนู
ู ุจุดูู ู
ูุซูู ุนูู HuggingFace.
ูุง ูุญุชุงุฌ API key.
"""
try:
r = requests.get(
"https://www.bing.com/search",
params={"q": query, "count": max_results + 5, "setlang": "en"},
headers={**_EMAIL_HEADERS,
"Accept-Language": "en-US,en;q=0.9",
"Referer": "https://www.bing.com/"},
timeout=15,
allow_redirects=True,
)
if r.status_code != 200:
log_activity("Email/Bing", f"ุจุญุซ '{query[:45]}'", "bing.com",
note=f"HTTP {r.status_code}", level="error")
return []
# ุงุณุชุฎุฑุงุฌ ุงูุฑูุงุจุท ู
ู Bing HTML
links = re.findall(
r'<h2[^>]*><a[^>]+href="(https?://[^"]+)"[^>]*>([^<]+)<',
r.text,
)
if not links:
# pattern ุจุฏูู
links = re.findall(
r'<a[^>]+href="(https?://[^"]+)"[^>]*class="[^"]*title[^"]*"[^>]*>([^<]{5,100})<',
r.text,
)
if not links:
# pattern ุนุงู
links = re.findall(
r'href="(https?://(?!www\.bing\.com)[^"]{10,200})"[^>]*>([^<]{5,100})<\/a>',
r.text,
)
results = []
seen_domains = set()
skip = _SKIP_DOMAINS + ["bing.com", "microsoft.com", "msn.com"]
for href, title in links:
href = href.strip()
if not href.startswith("http"):
continue
if any(d in href for d in skip):
continue
domain = href.split("/")[2] if "/" in href else href
if domain in seen_domains:
continue
seen_domains.add(domain)
results.append((href, title.strip()))
if len(results) >= max_results:
break
log_activity("Email/Bing", f"ุจุญุซ '{query[:45]}'", "bing.com",
found=len(results),
note=f"ูุฌุฏ {len(results)} ุฑุงุจุท",
level="info" if results else "warn")
return results
except Exception as e:
log_activity("Email/Bing", f"ุจุญุซ '{query[:45]}'", "bing.com",
note=str(e)[:80], level="error")
return []
def _ddg_search(query: str, max_results: int = 8) -> list:
"""DuckDuckGo fallback."""
try:
r = requests.post(
"https://html.duckduckgo.com/html/",
data={"q": query, "b": "", "kl": ""},
headers={**_EMAIL_HEADERS,
"Content-Type": "application/x-www-form-urlencoded"},
timeout=15,
allow_redirects=True,
)
if r.status_code not in (200, 202):
return []
links = re.findall(
r'<a[^>]+class="result__a"[^>]*href="([^"]+)"[^>]*>([^<]+)<',
r.text,
)
if not links:
links = re.findall(
r'href="(https?://[^"]{10,200})"[^>]*>([^<]{5,100})<',
r.text,
)
results = []
for href, title in links:
if "uddg=" in href:
m = re.search(r"uddg=([^&]+)", href)
href = requests.utils.unquote(m.group(1)) if m else href
href = href.strip()
if not href.startswith("http"):
continue
if any(d in href for d in _SKIP_DOMAINS + ["duckduckgo.com"]):
continue
results.append((href, title.strip()))
if len(results) >= max_results:
break
if results:
log_activity("Email/DDG", f"ุจุญุซ '{query[:45]}'", "duckduckgo.com",
found=len(results), note=f"ูุฌุฏ {len(results)} ุฑุงุจุท", level="info")
return results
except Exception:
return []
def _direct_source_search(query: str, max_results: int = 8) -> list:
"""
ุจุญุซ ู
ุจุงุดุฑ ูู ู
ุตุงุฏุฑ ู
ูุซููุฉ: GitHub APIุ Indie Hackersุ dev.to.
ููุณุชุฎุฏู
ุนูุฏู
ุง ุชูุดู ู
ุญุฑูุงุช ุงูุจุญุซ.
"""
results = []
clean = re.sub(r"[^a-zA-Z0-9 ]", " ", query).strip()[:80]
# โโ GitHub: ุงุจุญุซ ุนู repos ูusers ุจุฅูู
ููุงุชูู
โโ
if GITHUB_TOKEN:
try:
kw = clean.split()[0] if clean else "ai api"
r = requests.get(
f"https://api.github.com/search/repositories"
f"?q={requests.utils.quote(kw)}+topic:ai-api"
f"&sort=updated&per_page=10",
headers={"Authorization": f"token {GITHUB_TOKEN}",
"Accept": "application/vnd.github.v3+json"},
timeout=12,
)
if r.status_code == 200:
for repo in r.json().get("items", [])[:10]:
owner_url = repo.get("owner", {}).get("html_url", "")
desc = repo.get("description") or ""
name = repo.get("full_name","")
if owner_url and name:
results.append((f"https://github.com/{name}", desc or name))
if results:
log_activity("Email/GitHub", f"ุจุญุซ '{clean[:40]}'", "api.github.com",
found=len(results), note=f"ูุฌุฏ {len(results)} repo", level="info")
except Exception:
pass
# โโ Indie Hackers RSS โโ
if len(results) < max_results:
try:
r = requests.get(
"https://www.indiehackers.com/posts.json?limit=20",
headers=_EMAIL_HEADERS, timeout=10,
)
if r.status_code == 200:
for post in r.json().get("posts", [])[:10]:
url = "https://www.indiehackers.com" + post.get("url","")
title = post.get("title","")
if url and title and any(
kw.lower() in (title + post.get("content","")).lower()
for kw in ["api","chatbot","ai","llm","bot"]
):
results.append((url, title))
except Exception:
pass
return results[:max_results]
# โโ scrapling ููุฒุญู ุงูุฐูู (ุฅู ูุงูุช ู
ุซุจุชุฉ) โโ
try:
from scrapling import Fetcher as _ScrapFetcher
_SCRAPLING_OK = True
except ImportError:
_SCRAPLING_OK = False
def _fetch_page(url: str) -> tuple:
"""
ูุฌูุจ ุงูุตูุญุฉ ุจู scrapling ุฅู ูุงูุช ู
ุชุงุญุฉุ ูุฅูุง ุจู requests.
ูุฑุฌุน (html_text, plain_text).
"""
if _SCRAPLING_OK:
try:
fetcher = _ScrapFetcher(auto_match=False)
page = fetcher.get(url, timeout=12)
raw = page.html_content
text = page.get_all_text(ignore_tags=("script","style","head"))
return raw, text
except Exception:
pass
# fallback: requests ุนุงุฏู
r = requests.Session()
r.headers.update(_EMAIL_HEADERS)
resp = r.get(url, timeout=12, allow_redirects=True)
resp.raise_for_status()
raw = resp.text
text = re.sub(r"<[^>]+>", " ", raw)
text = re.sub(r"\s+", " ", text).strip()
return raw, text
EMAIL_PATTERN = re.compile(
r"[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}"
)
BAD_EMAIL_EXT = (".png",".jpg",".js",".css",".svg",".gif",".woff",".ico")
BAD_EMAIL_WORD = ("example","noreply","no-reply","support@","info@",
"contact@","hello@","admin@","test@","email@","webmaster",
"postmaster","bounce","mailer-daemon")
def _extract_emails(raw: str) -> list:
found = list(set(EMAIL_PATTERN.findall(raw)))
return [
e for e in found
if not any(e.endswith(x) for x in BAD_EMAIL_EXT)
and not any(w in e.lower() for w in BAD_EMAIL_WORD)
and len(e) < 60
and "." in e.split("@")[-1]
]
def email_harvester():
"""
ูุจุญุซ ุนู ุฅูู
ููุงุช ู
ุทูุฑูู ูุฃุตุญุงุจ ู
ูุงูุน:
DDG โ ูุชุญ ุงูู
ูุงูุน ุจู scrapling/requests โ ุงุณุชุฎุฑุงุฌ ุฅูู
ููุงุช.
"""
query = random.choice(EMAIL_SEARCH_QUERIES)
method = "Bing+DDG+GitHub"
targets = _web_search(query, max_results=10)
log_activity("Email", f"ุจุญุซ ุฌุฏูุฏ", query[:60],
found=len(targets),
note=f"ู
ุญุฑูุงุช ุจุญุซ: {method} | ูุฌุฏ {len(targets)} ูุฏู",
level="info" if targets else "warn")
print(f"\n๐ฅ Email harvest [{method}]: '{query[:50]}' โ {len(targets)} ูุฏู")
total_found = 0
total_queued = 0
for url, title in targets:
if memory.seen(url):
continue
try:
raw, page_text = _fetch_page(url)
# ุงุณุชุฎุฑุงุฌ ุฅูู
ูู ู
ู GitHub profile API ุฅุฐุง ูุงู ุงูุฑุงุจุท ุนูู GitHub
if "github.com/" in url and raw:
parts = url.rstrip("/").split("/")
if len(parts) >= 5 and parts[3]: # github.com/owner/repo
owner = parts[3]
try:
gh_headers = {"Authorization": f"token {GITHUB_TOKEN}",
"Accept": "application/vnd.github.v3+json"}
u = requests.get(f"https://api.github.com/users/{owner}",
headers=gh_headers, timeout=8)
if u.status_code == 200:
gh_email = u.json().get("email") or ""
if gh_email and "@" in gh_email:
raw += f" {gh_email} "
except Exception:
pass
found = _extract_emails(raw)
if not found:
log_activity("Email", f"ูุชุญ ุงูู
ููุน", url[:70],
found=0, note="ูุง ููุฌุฏ ุฅูู
ูู ูู ุงูุตูุญุฉ", level="info")
continue
total_found += len(found)
log_activity("Email", f"ุฅูู
ููุงุช ููุฌุฏุช", url[:70],
found=len(found),
note=f"ูุฌุฏ {len(found)} ุฅูู
ูู: {', '.join(found[:3])}", level="success")
LOCAL_STATS["emails_found"] = LOCAL_STATS.get("emails_found", 0) + len(found)
audience = ai_judge(page_text[:1500])
if not audience:
log_activity("Email", "ููุชุฑ ุงูุฌู
ููุฑ", url[:70],
note="ุงูู
ููุน ุบูุฑ ู
ุฑุชุจุท ุจู
ูุชุฌุงุชูุง", level="warn")
continue
company = title or (url.split("/")[2] if "/" in url else url)
data = generate_email(company, page_text[:600], audience)
if not data:
continue
added = 0
with _email_queue_lock:
for em in found[:2]:
email_id = f"email:{em}"
if not memory.user_seen(email_id):
_email_queue.append({
"to": em,
"subject": data["subject"],
"body": data["body"],
"url": url,
"title": title,
"email_id": email_id,
})
added += 1
memory.mark(url)
if added:
total_queued += added
LOCAL_STATS["emails_queued"] = LOCAL_STATS.get("emails_queued", 0) + added
log_activity("Email", "ุฃูุถูู ูููุงุฆู
ุฉ", url[:70],
found=added,
note=f"ุฌู
ููุฑ: {audience} | {added} ุฅูู
ูู ุฌุงูุฒ ููุฅุฑุณุงู",
level="success")
time.sleep(random.uniform(1, 3))
except Exception as e:
log_activity("Email", "ุฎุทุฃ ูู ุงูุฒุญู", url[:70],
note=str(e)[:80], level="error")
print(f" harvester skip {url[:40]}: {e}")
print(f" ๐ Email harvest: {total_found} ููุฌุฏ | {total_queued} ุฃูุถูู ูููุงุฆู
ุฉ")
def email_sender_loop():
"""
ููุฑุณู ู
ู _email_queue ุจุฅููุงุน ุจุดุฑู:
- ูุชุญูู ู
ู ูุงูุฐุฉ ุงูุฅุฑุณุงู (7 ุตุจุงุญุงู โ 11 ู
ุณุงุกู)
- ุชุฃุฎูุฑ ุนุดูุงุฆู 10-40 ุซุงููุฉ ุจูู ูู ุฅูู
ูู
- ูุญุชุฑู
ุงูุญุฏ ุงูููู
ู ุงูู
ุชุฏุฑุฌ
"""
print("๐ง Email sender: ุจุฏุฃ")
while True:
try:
cap = _email_daily_cap()
sent = LOCAL_STATS.get("email", 0)
if not _in_send_window():
h = datetime.utcnow().hour
log_activity("Email", "โธ ุงูุชุธุงุฑ ูุงูุฐุฉ ุงูุฅุฑุณุงู", "SMTP",
note=f"ุงูุณุงุนุฉ {h} UTC โ ุงูุฅุฑุณุงู ู
ุชุงุญ 07:00-23:00", level="warn")
time.sleep(300)
continue
if sent >= cap:
log_activity("Email", "โธ ูุตู ุงูุญุฏ ุงูููู
ู", "SMTP",
note=f"{sent}/{cap} ุฅูู
ูู ุงูููู
", level="warn")
time.sleep(600)
continue
with _email_queue_lock:
qsize = len(_email_queue)
if qsize == 0:
time.sleep(10)
continue
with _email_queue_lock:
if not _email_queue:
pass
else:
item = _email_queue.pop(0)
ok, msg = send_email(
item["to"], item["subject"], item["body"],
sender_name=_random_sender()
)
if ok:
memory.mark_user(item["email_id"])
memory.log("Email", item["title"], item["url"],
f"โ {item['to']}", item["body"])
antiban.record("email")
LOCAL_STATS["emails_sent"] = LOCAL_STATS.get("emails_sent", 0) + 1
log_activity("Email", f"โ ุฅูู
ูู ุฃูุฑุณู", item["to"],
found=1,
note=f"ุงูู
ูุถูุน: {item['subject'][:60]} | {sent+1}/{cap}",
level="success")
log_sent_email(item["to"], item["subject"],
item["body"], item["url"], item["title"])
print(f"โ
Email โ {item['to']} (cap:{cap})")
time.sleep(random.uniform(10, 40))
continue
else:
log_activity("Email", "โ ูุดู ุงูุฅุฑุณุงู", item["to"],
note=msg, level="error")
print(f" โ Email failed: {msg}")
except Exception as e:
log_activity("Email", "ุฎุทุฃ ูู ุงูู
ูุฑุณูู", "SMTP",
note=str(e)[:80], level="error")
print(f"Sender error: {e}")
time.sleep(random.uniform(3, 8))
def email_harvester_loop():
"""ูุดุบูู ุงูุญุตูุงุฏ ุจุดูู ุฏูุฑู ูู
ูุก ุงููุงุฆู
ุฉ (ุจุฏูู asyncio)."""
cycle = 0
while True:
try:
with _email_queue_lock:
qsize = len(_email_queue)
cycle += 1
if qsize < 50:
log_activity("Email", f"ุฏูุฑุฉ ุญุตุงุฏ #{cycle}", "DuckDuckGo",
note=f"ุงููุงุฆู
ุฉ {qsize} โ ูุจุฏุฃ ุงูุจุญุซ", level="info")
email_harvester()
else:
log_activity("Email", "โธ ุงููุงุฆู
ุฉ ู
ู
ุชูุฆุฉ", "Queue",
found=qsize,
note=f"{qsize} ุฅูู
ูู ุจุงูุชุธุงุฑ ุงูุฅุฑุณุงู", level="warn")
except Exception as e:
log_activity("Email", "ุฎุทุฃ ูู ุงูุญุตุงุฏ", "โ",
note=str(e)[:80], level="error")
print(f" โ Harvester loop error: {e}")
wait = random.randint(120, 300)
time.sleep(wait)
# ==========================================
# 12b. ู
ุฑุงูุจุฉ ุงูุฑุฏูุฏ ุนูู ุชุนูููุงุชูุง
# ==========================================
def replies_monitor_loop():
"""
ูุฑุงูุจ ุงูุฑุฏูุฏ ุนูู ุชุนูููุงุชูุง ูู GitHub ูReddit ูู 15 ุฏูููุฉ.
ูุณุฌูู ุฃู ุฑุฏ ุฌุฏูุฏ ูู REPLIES_LOG ูุนุฏุงุฏุงุช ุงูุฅุญุตุงุฆูุงุช.
"""
print("๐ Replies monitor: ุจุฏุฃ")
gh_headers = {"Authorization": f"token {GITHUB_TOKEN}",
"Accept": "application/vnd.github.v3+json"}
while True:
try:
# โโ GitHub: ุชุญูู ู
ู ุฑุฏูุฏ ุนูู ุชุนูููุงุชูุง โโ
if GITHUB_TOKEN:
with _our_comments_lock:
gh_snap = list(_our_github_comments[-30:])
for rec in gh_snap:
try:
# ุฌูุจ ุงูุชุนูููุงุช ุนูู ุงูู issue
r = requests.get(
rec["repo_api"] + "/comments",
headers=gh_headers, timeout=10,
)
if r.status_code != 200:
continue
for c in r.json():
c_id = str(c.get("id", ""))
c_key = f"ghreply:{c_id}"
if str(c_id) == str(rec["comment_id"]):
continue # ุชุนููููุง ููุณู
if memory.seen(c_key):
continue
author = c.get("user", {}).get("login", "")
body = (c.get("body") or "")
if not body.strip():
continue
# ูู ูู ุฑุฏ ุจุนุฏ ุชุนููููุงุ
our_ts = rec.get("ts", "")
c_ts = c.get("created_at", "")
if our_ts and c_ts and c_ts < our_ts:
continue
memory.mark(c_key)
log_reply("GitHub", author, rec["title"],
body, rec["url"])
log_activity("GitHub", "ุฑุฏ ุฌุฏูุฏ ุนูู ุชุนููููุง",
rec["title"][:60],
note=f"ู
ู @{author}: {body[:80]}",
level="success")
print(f" ๐ฌ GitHub reply from @{author} on: {rec['title'][:40]}")
except Exception as e:
print(f" GitHub reply check error: {e}")
# โโ Reddit: ุชุญูู ู
ู ุฑุฏูุฏ ุนูู ุชุนูููุงุชูุง โโ
sess = _get_reddit_session()
if sess:
with _our_comments_lock:
rd_snap = list(_our_reddit_comments[-20:])
for rec in rd_snap:
try:
# ุฌูุจ ุชุนูููุงุช ุงูู
ูุดูุฑ
post_json_url = rec["post_url"].rstrip("/") + ".json?limit=50"
r = sess.get(post_json_url, timeout=12)
if r.status_code != 200:
continue
data = r.json()
comments_listing = data[1].get("data", {}).get("children", []) if len(data) > 1 else []
for ch in comments_listing:
c = ch.get("data", {})
c_id = c.get("name", "")
c_key = f"rdreply:{c_id}"
if memory.seen(c_key):
continue
author = c.get("author", "")
body = (c.get("body") or "")
if not body.strip() or author == "[deleted]":
continue
our_ts = rec.get("ts", "")
c_ts_ut = c.get("created_utc", 0)
try:
c_ts = datetime.utcfromtimestamp(c_ts_ut).isoformat()
if our_ts and c_ts < our_ts:
continue
except Exception:
pass
memory.mark(c_key)
log_reply("Reddit", author, rec["title"], body, rec["post_url"])
log_activity("Reddit", "ุฑุฏ ุฌุฏูุฏ ุนูู ุชุนููููุง",
rec["title"][:60],
note=f"ู
ู u/{author}: {body[:80]}",
level="success")
print(f" ๐ฌ Reddit reply from u/{author} on r/{rec.get('sub','')}")
except Exception as e:
print(f" Reddit reply check error: {e}")
except Exception as e:
print(f"Replies monitor error: {e}")
time.sleep(900) # ูู 15 ุฏูููุฉ
def _print_keys_status():
"""ูุทุจุน ุญุงูุฉ ูู ุงูู
ูุงุชูุญ ุนูุฏ ุงูุจุฏุก."""
print()
print("โ" * 50)
print("๐ ูุญุต ุงูู
ูุงุชูุญ")
print("โ" * 50)
keys = [
("NVIDIA_API_KEY", NVIDIA_API_KEY, "๐ค AI Engine", True),
("GITHUB_TOKEN", GITHUB_TOKEN, "๐ GitHub", True),
("SMTP_EMAIL", SMTP_EMAIL, "๐ง Email (From)", True),
("SMTP_PASSWORD", SMTP_PASSWORD, "๐ง Email (Password)", True),
("UPSTASH_REDIS_REST_URL", UPSTASH_REDIS_REST_URL, "๐ง Redis Memory", True),
("UPSTASH_REDIS_REST_TOKEN", UPSTASH_REDIS_REST_TOKEN, "๐ง Redis Token", True),
("REDDIT_CLIENT_ID", REDDIT_CLIENT_ID, "๐ Reddit Client ID", True),
("REDDIT_CLIENT_SECRET", REDDIT_CLIENT_SECRET, "๐ Reddit Secret", True),
("REDDIT_USERNAME", REDDIT_USERNAME, "๐ Reddit Username", True),
("REDDIT_PASSWORD", REDDIT_PASSWORD, "๐ Reddit Password", True),
("DISCORD_BOT_TOKEN", DISCORD_BOT_TOKEN, "๐ฌ Discord", False),
("DEVTO_API_KEY", DEVTO_API_KEY, "๐ Dev.to", False),
("PRODUCTHUNT_API_KEY", PH_API_KEY, "๐ ProductHunt Key", False),
("PRODUCTHUNT_API_SECRET", PH_API_SECRET, "๐ ProductHunt Secret", False),
("STACKOVERFLOW_API_KEY", SO_API_KEY, "๐ป StackOverflow", False),
]
all_ok = True
for name, val, label, required in keys:
has = bool(val)
icon = "โ
" if has else ("โ" if required else "โช")
status = "ู
ูุฌูุฏ" if has else ("ู
ูููุฏ!" if required else "ุงุฎุชูุงุฑู")
print(f" {icon} {label:25s} {status}")
if required and not has:
all_ok = False
print("โ" * 50)
if all_ok:
print("โ
ูู ุงูู
ูุงุชูุญ ุงูุฅูุฒุงู
ูุฉ ู
ูุฌูุฏุฉ โ ุงูุจูุช ุฌุงูุฒ")
else:
print("โ ๏ธ ุจุนุถ ุงูู
ูุงุชูุญ ุงูุฅูุฒุงู
ูุฉ ู
ูููุฏุฉ โ ุจุนุถ ุงูู
ูุตุงุช ุณุชููู ู
ุนุทููุฉ")
print("โ" * 50)
print()
def start_all():
# โโ ุงุฎุชุจุงุฑ SMTP ููุฑ ุงูุจุฏุก โโ
smtp_ok, smtp_msg = test_smtp_connection()
print(f"{'โ
' if smtp_ok else 'โ'} SMTP: {smtp_msg}")
if not smtp_ok:
print("โ ๏ธ ุงูุฅูู
ููุงุช ูู ุชูุฑุณู ุญุชู ููุตูุญ SMTP")
# ุชุญู
ูู ุฅุญุตุงุฆูุงุช ุงูููู
ู
ู Redis (ุชุจูู ุจุนุฏ ุงูู restart)
saved = memory.load_stats()
if saved:
for k, v in saved.items():
if k in LOCAL_STATS:
LOCAL_STATS[k] = v
print(f"๐ ุฅุญุตุงุฆูุงุช ุงูููู
ู
ุญู
ููุฉ ู
ู Redis: {LOCAL_STATS}")
_print_keys_status()
threads = [
threading.Thread(target=_keyword_refresh_loop, daemon=True),
threading.Thread(target=github_loop, daemon=True),
threading.Thread(target=reddit_loop, daemon=True),
threading.Thread(target=devto_loop, daemon=True),
threading.Thread(target=stackoverflow_loop, daemon=True),
threading.Thread(target=producthunt_loop, daemon=True),
threading.Thread(target=discord_monitor_loop, daemon=True),
threading.Thread(target=email_harvester_loop, daemon=True),
threading.Thread(target=email_sender_loop, daemon=True),
threading.Thread(target=replies_monitor_loop, daemon=True),
]
for t in threads:
t.start()
total = sum(LIMITS.values())
print(f"๐ Orgteh Marketing Engine โ 8 ู
ูุตุงุช ุชุนู
ู | ุงูุทุงูุฉ ุงูููู
ูุฉ: {total:,} ุฑุณุงูุฉ")
start_all()
# ==========================================
# 14. ูุงุฌูุฉ Gradio โ ููุญุฉ ุชุญูู
ูุงู
ูุฉ
# ==========================================
def refresh_stats():
with _keyword_lock:
kw_count = len(_keyword_cache)
last_refresh = (
datetime.utcfromtimestamp(_last_keyword_refresh).strftime("%H:%M UTC")
if _last_keyword_refresh else "ูู
ูุชู
ุจุนุฏ"
)
s = LOCAL_STATS
total_actions = (s.get("reddit",0) + s.get("github",0) + s.get("devto",0)
+ s.get("stackoverflow",0) + s.get("producthunt",0)
+ s.get("discord",0))
with _email_queue_lock:
q_now = len(_email_queue)
return (
s.get("reddit", 0),
s.get("github", 0),
s.get("email", 0),
s.get("devto", 0),
s.get("stackoverflow", 0),
s.get("producthunt", 0),
s.get("discord", 0),
total_actions,
s.get("emails_found", 0),
s.get("emails_queued", 0),
s.get("emails_sent", 0),
q_now,
s.get("replies_received", 0),
f"{kw_count} ููู
ุฉ | ุขุฎุฑ ุชุฌุฏูุฏ: {last_refresh}",
)
def refresh_activity_log():
"""ุณุฌู ุงููุดุงุท ุงูุชูุตููู โ ูู ุนู
ููุฉ ุจุญุซ ููู ู
ูุตุฉ."""
with _activity_lock:
logs = list(ACTIVITY_LOGS[:150])
if not logs:
return "โณ ุงูุจูุช ูุนู
ู ูู ุงูุฎูููุฉ โ ูุง ูุดุงุท ู
ุณุฌูู ุจุนุฏ..."
lines = []
for entry in logs:
icon = entry.get("icon", "๐")
ts = entry.get("ts", "")
plat = entry.get("platform", "")
action = entry.get("action", "")
site = entry.get("site", "")
found = entry.get("found", 0)
note = entry.get("note", "")
found_str = f" [{found}]" if found else ""
lines.append(f"{icon} [{ts}] {plat} โ {action}{found_str}")
if site:
lines.append(f" ๐ {site}")
if note:
lines.append(f" ๐ฌ {note}")
lines.append("")
return "\n".join(lines)
def refresh_sent_emails():
"""ุณุฌู ุงูุฅูู
ููุงุช ุงูู
ุฑุณูุฉ."""
with _activity_lock:
logs = list(SENT_EMAILS_LOG[:80])
if not logs:
return "๐ญ ูู
ููุฑุณู ุฃู ุฅูู
ูู ุจุนุฏ..."
lines = []
for e in logs:
lines.append("โ" * 50)
lines.append(f"๐ {e.get('ts','')} โ ๐ง {e.get('to','')}")
lines.append(f"๐ ุงูู
ูุถูุน: {e.get('subject','')}")
lines.append(f"๐ ุงูู
ุตุฏุฑ: {e.get('url','')[:70]}")
lines.append(f"๐ {e.get('body','')[:200]}")
lines.append("")
return "\n".join(lines)
def refresh_replies_log():
"""ุณุฌู ุงูุฑุฏูุฏ ุนูู ุชุนูููุงุชูุง ูุฑุณุงุฆููุง."""
with _activity_lock:
logs = list(REPLIES_LOG[:60])
if not logs:
return "๐ฌ ูุง ุฑุฏูุฏ ู
ุณุชูู
ุฉ ุจุนุฏ โ ูุฑุงูุจ ุงูุจูุช ูู 15 ุฏูููุฉ..."
lines = []
for r in logs:
lines.append("โ" * 50)
lines.append(f"๐ {r.get('ts','')} [{r.get('platform','')}]")
lines.append(f"๐ค ู
ู: {r.get('from_user','')}")
lines.append(f"๐ค ุชุนููููุง: {r.get('our_content','')[:120]}")
lines.append(f"๐ฌ ุฑุฏูู: {r.get('their_reply','')[:300]}")
if r.get("url"):
lines.append(f"๐ {r.get('url','')[:80]}")
lines.append("")
return "\n".join(lines)
def refresh_interaction_log():
"""ุงูุณุฌู ุงูููุงุณููู ููุชูุงุนูุงุช (ุชุนูููุงุช + ุฑุฏูุฏ)."""
logs = memory.load_logs()
if not logs:
return "ูุง ููุฌุฏ ูุดุงุท ุจุนุฏ โ ุงูุจูุช ูุนู
ู ูู ุงูุฎูููุฉ..."
lines = []
for log in list(reversed(logs))[:60]:
lines.append("โ" * 45)
lines.append(f"{log.get('ts','')} [{log.get('platform','')}]")
lines.append(log.get("title", ""))
if log.get("url"):
lines.append(log.get("url", ""))
lines.append(log.get("reply", "")[:250])
lines.append("")
return "\n".join(lines)
ICON_MAP = {
"reddit": "๐ ",
"github": "๐",
"email": "๐ง",
"devto": "๐",
"stackoverflow":"๐ป",
"producthunt": "๐",
"discord": "๐ฌ",
}
CSS = """
.stat-card { border-radius: 10px; padding: 6px; text-align: center; }
.gr-number input { font-size: 1.4em; font-weight: bold; text-align: center; }
"""
with gr.Blocks(title="Orgteh Marketing Engine") as demo:
gr.Markdown(
"# ๐ Orgteh Marketing Engine\n"
"**ุงูู
ููุน:** orgteh.com | "
"**ุงูู
ูุตุงุช:** ๐ GitHub ยท ๐ Reddit ยท ๐ Dev.to ยท ๐ป StackOverflow ยท "
"๐ ProductHunt ยท ๐ฌ Discord ยท ๐ง Email"
)
# โโ ุตู ุงูุฅุญุตุงุฆูุงุช ุงูุฑุฆูุณูุฉ โโ
with gr.Row():
r_reddit = gr.Number(label="๐ Reddit", min_width=80)
r_github = gr.Number(label="๐ GitHub", min_width=80)
r_email = gr.Number(label="๐ง Email ู
ูุฑุณูู", min_width=80)
r_devto = gr.Number(label="๐ Dev.to", min_width=80)
r_so = gr.Number(label="๐ป StackOverflow",min_width=80)
r_ph = gr.Number(label="๐ ProductHunt", min_width=80)
r_discord = gr.Number(label="๐ฌ Discord DMs", min_width=80)
# โโ ุตู ุฅุญุตุงุฆูุงุช ุงูุฅูู
ูู ุงูุชูุตูููุฉ โโ
with gr.Row():
r_total = gr.Number(label="๐ ุฅุฌู
ุงูู ุงูุฅุฌุฑุงุกุงุช ุงูููู
", min_width=100)
r_found = gr.Number(label="๐ ุฅูู
ููุงุช ููุฌุฏุช", min_width=100)
r_queued = gr.Number(label="๐ฅ ูู ูุงุฆู
ุฉ ุงูุงูุชุธุงุฑ", min_width=100)
r_sent = gr.Number(label="โ ุฅูู
ููุงุช ุฃูุฑุณูุช", min_width=100)
r_queue_now = gr.Number(label="โณ ุจุงูุชุธุงุฑ ุงูุฅุฑุณุงู ุงูุขู", min_width=100)
r_replies = gr.Number(label="๐ฌ ุฑุฏูุฏ ู
ุณุชูู
ุฉ", min_width=100)
r_keywords = gr.Textbox(label="๐ ููู
ุงุช ุงูุจุญุซ", interactive=False, min_width=160)
with gr.Row():
refresh_btn = gr.Button("๐ ุชุญุฏูุซ ุงููู", variant="primary", size="lg")
copy_all_btn = gr.Button("๐ ูุณุฎ ูู ุงูุณุฌูุงุช", variant="secondary", size="lg")
smtp_test_btn = gr.Button("๐ ุงุฎุชุจุงุฑ SMTP", variant="secondary", size="lg")
send_test_btn = gr.Button("โ ุฅุฑุณุงู ุฅูู
ูู ุชุฌุฑูุจู", variant="secondary", size="lg")
smtp_status_box = gr.Textbox(
label="๐ ุญุงูุฉ SMTP",
value="ุงุถุบุท 'ุงุฎุชุจุงุฑ SMTP' ููุชุญูู",
interactive=False,
)
test_email_input = gr.Textbox(
label="โ ุฅูู
ููู ูุงุณุชูุจุงู ุงูุฅูู
ูู ุงูุชุฌุฑูุจู",
placeholder="your@email.com",
interactive=True,
)
test_email_result = gr.Textbox(
label="ูุชูุฌุฉ ุงูุฅุฑุณุงู ุงูุชุฌุฑูุจู",
interactive=False,
)
copy_all_box = gr.Textbox(
label="๐ ุงูุณุฎ ู
ู ููุง (ูู ุงูุณุฌูุงุช ู
ุฌู
ูุนุฉ)",
lines=4, interactive=True, visible=False,
placeholder="ุงุถุบุท 'ูุณุฎ ูู ุงูุณุฌูุงุช' ุฃููุงู..."
)
# โโ ุงูุชุจููุจุงุช โโ
with gr.Tabs():
with gr.Tab("๐ ุณุฌู ุงููุดุงุท ุงูุชูุตููู"):
gr.Markdown(
"ูู ุนู
ููุฉ ุจุญุซ ููู ู
ูุตุฉ โ ููุธูุฑ ูู
ุฅูู
ูู ูุฌุฏุ ุฃู ู
ููุน ุฒุงุฑูุ "
"ูู ูุฌุญ ุงูุชุนููู ุฃู
ูุง"
)
with gr.Row():
copy_activity_btn = gr.Button("๐ ูุณุฎ ุงูุณุฌู", size="sm")
activity_view = gr.Textbox(
label="ุงููุดุงุท ุงูุญู", lines=30, max_lines=50,
interactive=False
)
with gr.Tab("โ
ุงูุชูุงุนูุงุช ุงูู
ููุฌุฒุฉ"):
gr.Markdown("ุงูุชุนูููุงุช ูุงูุฑุฏูุฏ ุงูุชู ุฃุฑุณููุง ุงูุจูุช ุจูุฌุงุญ ุนูู ุฌู
ูุน ุงูู
ูุตุงุช")
with gr.Row():
copy_interaction_btn = gr.Button("๐ ูุณุฎ ุงูุณุฌู", size="sm")
interaction_view = gr.Textbox(
label="ุณุฌู ุงูุชูุงุนูุงุช", lines=30, max_lines=50,
interactive=False
)
with gr.Tab("โ ุงูุฅูู
ููุงุช ุงูู
ูุฑุณููุฉ"):
gr.Markdown(
"ูู ุฅูู
ูู ุฃูุฑุณู: ุงููุฌูุฉุ ุงูู
ูุถูุนุ ูุต ุงูุฑุณุงูุฉุ ู
ุตุฏุฑ ุงูุฅูู
ูู"
)
with gr.Row():
copy_sent_btn = gr.Button("๐ ูุณุฎ ุงูุณุฌู", size="sm")
sent_emails_view = gr.Textbox(
label="ุงูุฅูู
ููุงุช ุงูู
ุฑุณูุฉ", lines=30, max_lines=50,
interactive=False
)
with gr.Tab("๐ฌ ุงูุฑุฏูุฏ ุงููุงุฑุฏุฉ"):
gr.Markdown(
"ุฑุฏูุฏ ุงูู
ุณุชุฎุฏู
ูู ุนูู ุชุนูููุงุชูุง ูู GitHub ูReddit โ "
"ููุญุฏููุซ ูู 15 ุฏูููุฉ ุชููุงุฆูุงู"
)
with gr.Row():
copy_replies_btn = gr.Button("๐ ูุณุฎ ุงูุณุฌู", size="sm")
replies_view = gr.Textbox(
label="ุงูุฑุฏูุฏ ุนูู ุชุนูููุงุชูุง", lines=30, max_lines=50,
interactive=False
)
# โโ ุฑุจุท ุงูุฃุฒุฑุงุฑ ูุงูุชุญู
ูู โโ
stats_outs = [
r_reddit, r_github, r_email, r_devto, r_so, r_ph, r_discord,
r_total, r_found, r_queued, r_sent, r_queue_now, r_replies, r_keywords,
]
# โโ ูุธููุฉ ูุณุฎ ุงููุต (ุชูุนูุฏ ุงููุต ูุงู
ูุงู ูุนูุตุฑ ู
ุคูุช ูุงุจู ูููุณุฎ) โโ
def get_all_logs():
"""ูุฌู
ุน ูู ุงูุณุฌูุงุช ูู ูุต ูุงุญุฏ ูููุณุฎ."""
parts = [
"โโโ ุณุฌู ุงููุดุงุท โโโ", refresh_activity_log(),
"\nโโโ ุงูุชูุงุนูุงุช ุงูู
ููุฌุฒุฉ โโโ", refresh_interaction_log(),
"\nโโโ ุงูุฅูู
ููุงุช ุงูู
ูุฑุณููุฉ โโโ", refresh_sent_emails(),
"\nโโโ ุงูุฑุฏูุฏ ุงููุงุฑุฏุฉ โโโ", refresh_replies_log(),
]
return "\n".join(parts)
copy_all_out = gr.Textbox(label="๐ ูู ุงูุณุฌูุงุช (ูููุณุฎ)", lines=5,
interactive=True, visible=False)
copy_activity_btn.click(refresh_activity_log, outputs=[copy_all_out])
copy_interaction_btn.click(refresh_interaction_log, outputs=[copy_all_out])
copy_sent_btn.click(refresh_sent_emails, outputs=[copy_all_out])
copy_replies_btn.click(refresh_replies_log, outputs=[copy_all_out])
refresh_btn.click(refresh_stats, outputs=stats_outs)
refresh_btn.click(refresh_activity_log, outputs=[activity_view])
refresh_btn.click(refresh_interaction_log, outputs=[interaction_view])
refresh_btn.click(refresh_sent_emails, outputs=[sent_emails_view])
refresh_btn.click(refresh_replies_log, outputs=[replies_view])
# โโ ุฒุฑ ูุณุฎ ูู ุงูุณุฌูุงุช โโ
def collect_all_logs():
parts = [
"โ" * 50,
" ุณุฌู ุงููุดุงุท ุงูุชูุตููู",
"โ" * 50,
refresh_activity_log(),
"",
"โ" * 50,
" ุงูุชูุงุนูุงุช ุงูู
ููุฌุฒุฉ",
"โ" * 50,
refresh_interaction_log(),
"",
"โ" * 50,
" ุงูุฅูู
ููุงุช ุงูู
ูุฑุณููุฉ",
"โ" * 50,
refresh_sent_emails(),
"",
"โ" * 50,
" ุงูุฑุฏูุฏ ุงููุงุฑุฏุฉ",
"โ" * 50,
refresh_replies_log(),
]
return gr.update(value="\n".join(parts), visible=True)
copy_all_btn.click(collect_all_logs, outputs=[copy_all_box])
# โโ ุงุฎุชุจุงุฑ SMTP โโ
def run_smtp_test():
ok, msg = test_smtp_connection()
with _email_queue_lock:
q = len(_email_queue)
cap = _email_daily_cap()
sent = LOCAL_STATS.get("email", 0)
status = (
f"{msg}\n"
f"{'โ'*40}\n"
f"ูุงุฆู
ุฉ ุงูุงูุชุธุงุฑ: {q} ุฅูู
ูู\n"
f"ู
ูุฑุณูู ุงูููู
: {sent}/{cap}\n"
f"ูุงูุฐุฉ ุงูุฅุฑุณุงู: {'โ
ู
ูุชูุญุฉ' if _in_send_window() else 'โธ ู
ุบููุฉ'}\n"
f"ุฅูู
ููุงุช ู
ูุชุดูุฉ: {LOCAL_STATS.get('emails_found',0)}\n"
f"ุฅูู
ููุงุช ูู ุงููุงุฆู
ุฉ (ู
ุฌู
ูุน): {LOCAL_STATS.get('emails_queued',0)}"
)
return status
smtp_test_btn.click(run_smtp_test, outputs=[smtp_status_box])
# โโ ุฅูู
ูู ุชุฌุฑูุจู โโ
def send_test_email_fn(to_addr):
if not to_addr or "@" not in to_addr:
return "โ ุฃุฏุฎู ุฅูู
ููุงู ุตุญูุญุงู"
ok, msg = test_smtp_connection()
if not ok:
return f"โ SMTP ูุดู ุฃููุงู: {msg}"
subject = "โ
ุงุฎุชุจุงุฑ ู
ู Orgteh Marketing Engine"
body = (
"ูุฐุง ุฅูู
ูู ุชุฌุฑูุจู ูุงุฎุชุจุงุฑ ูุธุงู
ุงูุฅุฑุณุงู.\n\n"
f"ุงูููุช: {datetime.utcnow().strftime('%Y-%m-%d %H:%M UTC')}\n"
f"ุงูุฎุงุฏู
: {SMTP_SERVER}:{SMTP_PORT}\n"
f"ุงูู
ูุฑุณูู: {SMTP_EMAIL}\n\n"
"ุฅุฐุง ูุตูู ูุฐุง ุงูุฅูู
ูู ููุธุงู
ุงูุฅุฑุณุงู ูุนู
ู ุจุดูู ุตุญูุญ."
)
ok2, msg2 = send_email(to_addr, subject, body, sender_name="Orgteh Test")
if ok2:
return f"โ
ุฃูุฑุณู ุจูุฌุงุญ ุฅูู {to_addr} โ ุชุญูู ู
ู ุตูุฏูู ุงููุงุฑุฏ"
return f"โ ูุดู ุงูุฅุฑุณุงู: {msg2}"
send_test_btn.click(send_test_email_fn,
inputs=[test_email_input],
outputs=[test_email_result])
demo.load(refresh_stats, outputs=stats_outs)
demo.load(refresh_activity_log, outputs=[activity_view])
demo.load(refresh_interaction_log, outputs=[interaction_view])
demo.load(refresh_sent_emails, outputs=[sent_emails_view])
demo.load(refresh_replies_log, outputs=[replies_view])
if __name__ == "__main__":
demo.launch(server_name="0.0.0.0", server_port=7860,
css=CSS, theme=gr.themes.Soft())
|