Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
20 kB
6
Indexable
Never
from datetime import datetime
from googleapiclient.discovery import build
import google_auth_oauthlib.flow
import googleapiclient.discovery
from googleapiclient.discovery import build_from_document
import os
from oauth2client.client import flow_from_clientsecrets
from oauth2client.tools import run_flow
from queue import Queue
import random
import time
from threading import Thread

video_fetch_cycle_time = 1200
comment_delay_time = 60
sleep_time_between_polls = 30
videos = Queue(maxsize = 0)
api_keys = [
    'AIzaSyBuyhWw1KspIYNzyLs_T3BLU4vt5RMytHA'
]
client_secrets_files = [
    "client_secret_715813491677-ikdn90879bpsa8ueipeob915tdrfldhn.apps.googleusercontent.com.json"
]
channel_ids_to_channel_type = {
    'UCmTM_hPCeckqN3cPWtYZZcg': 'Left',
    'UCz4a7agVFr1TxU-mpAP8hkw': 'Left',
    'UC-CSyyi47VX1lD9zyeABW3w': 'Left',
    'UCrYpceU8cvXNSqaiYC-8hJA': 'Left',
}
scopes = ["https://www.googleapis.com/auth/youtube.force-ssl"]
comments_by_channel_type = {
    'Left': [
        '*Dr. B.R. Ambedkar:* The allegiance of a Muslim does not rest on his domicile in the country which is his but on the faith to which he belongs. To the Muslim, Where it is well with me there is my country is unthinkable. Wherever there is the rule of Islam, there is his own country. *In other words, Islam can never allow a true Muslim to adopt India as his motherland and regard a Hindu as his kith and kin*\n-Source: "pakistan or partition of India" Book by Ambedkar',
        '*1st Education minister of India maulana Abdul Kalam Azad:* Be extremely hard against kafirs (nonmuslims) but extremely kind among ourselves (muslims). All relationships in the world can break down, father can turn against son, brother against brother, mother can shun her child but the relationship of a Muslim with a Muslim can never be severed. And then we ask why our Education System is bad\n-Source: Speech at 1920',
        'Son: Dad what is Hypocrisy?\n\nDad:\n1. Hypocrisy is when 85% of a community votes in 1946 for pakistan but do not leave to pakistan in 1947.\n2.Hypocrisy is when 75% according to PewResearch Centre want sharia law but call themselves secular',
        'Those people who can partition a country into 2 are not a minority but a well organized group\n- Sardar Vallabhai Patel',
        '*Sardar Vallabhbhai Patel:* Most of the Muslims who have stayed back in India, helped in creating Pakistan. Now, I do not understand what has changed in one night that they are asking us not to doubt their loyalty\n-Speech in Kolkata, 1948. Video is on YouTube please check.',
        '*Hey can you please make a video on the ongoing genocide and forceful conversion of Hindus in pakistan and bangladesh. As per a recent statistic, everyday close to 3 pakistan Hindu women are picked, married and forcibly converted. During the partition, the Hindu Demographics in pak was 15% and is now 2% and in bd it was 25% and now is 8%. Peoples houses are burned, they are looted and sometimes even worse they are killed if they deny conversion. Whatever is happening is beyond imagination and you will discover new things as you Dive Deep into this. As per my observations, this channel has been exposing truths multiple times so requesting you to make a video on this. Thanks 🙏!*',
        '*Who voted for partition? Here are the Results for 1946 Election for partition and you judge it:* \n\n*Assam:* \nMuslim Seats: 34\nMuslim League(For partition): 31\nWin Percentage: 91%\n\n*Bengal:* \nMuslim Seats: 119\nMuslim League(For partition): 113\nWin Percentage: 95%\n\n*Bihar:* \nMuslim Seats: 40\nMuslim League(For partition): 34\nWin Percentage: 85%\n\n*Bombay:* \nMuslim Seats: 30\nMuslim League(For partition): 30\nWin Percentage: 100%\n\n*Central Provinces:* \nMuslim Seats: 14\nMuslim League(For partition): 13\nWin Percentage: 93%\n\n*Madras:* \nMuslim Seats: 29\nMuslim League(For partition): 29\nWin Percentage: 100%\n\n*NWFP:*	\nMuslim Seats: 36\nMuslim League(For partition): 17\nWin Percentage: 47%\n\n*Orissa:* \nMuslim Seats: 4	\nMuslim League(For partition): 4\nWin Percentage: 100%\n\n*Punjab:* \nMuslim Seats: 86 \nMuslim League(For partition): 74\nWin Percentage: 86%\n\n*Sind:* \nMuslim Seats: 34 \nMuslim League(For partition): 28\nWin Percentage: 82%\n\n*United Provinces:* \nMuslim Seats: 66 \nMuslim League(For partition): 54\nWin Percentage: 82%\n\n*Total Win Percentage:* 87%\n- Source: Wikipedia 1946 Indian Provincial Elections\n\n *Sardar Vallabhai Patel:* Most of the Muslims who have stayed back in India, helped in creating Pakistan. Now, I do not understand what has changed in one night that they are asking us not to doubt their loyalty\n\n*Dr. B.R. Ambedkar:* The allegiance of a Muslim does not rest on his domicile in the country which is his but on the faith to which he belongs. To the Muslim, Where it is well with me there is my country is unthinkable. Wherever there is the rule of Islam, there is his own country. *In other words, Islam can never allow a true Muslim to adopt India as his motherland and regard a Hindu as his kith and kin*\n-Source: "pakistan or partition of India" Book by Ambedkar\n\n*1st Education minister of India maulana Abdul Kalam Azad:* Be extremely hard against kafirs (nonmuslims) but extremely kind among ourselves (muslims). All relationships in the world can break down, father can turn against son, brother against brother, mother can shun her child but the relationship of a Muslim with a Muslim can never be severed. And then we ask why our Education System is bad\nSpeech at 1920',
        'Govt left want VS Govt right wants\n\nleft govt:\n1. PM: rahul gandhi\n2. President: priyanka gandhi\n3. immigration minister: mamata banerjee (allow all illegal idiots to India)\n4. nsa head: Owaisi (reveal all secrets)\n5. financial minister: kejriwal (freebie)\n6. education minister: kanhaiya kumar (spend no time in education and do dange fasad)\n7. foreign minister: sonia gandhi (because foreign)\n8. home minister: kcr (Because always in home) \n\nGovt right wants:\n1. PM: Modi\n2. Home Minister: Amit Shah\n3. immigration minister: Himanta Biswas Sarma\n4. secularism minister: Yogi Ji\n5. financial minister: Subramanian Swamy\n6. NSA Head: Samant Goyal\n7. foreign minister: S Jai Shankar',
        'Son: Dad what will happen if thousands of idiots gather and walk together?\nDad: Bharat Jodo Yatra Son',
        "**7 Reasons Why Hindus are 7th Class Citizens in India**\n1. Kashmiri Hindus were raped, killed and thrown out of their homes. Kashmiri Pandits the original inhabitants cannot go to their homes but rohingyas can illegally get citizenship and styay in Jammu\n2. Hindu Temples controlled by govt and have to pay taxes but other places of worship not controlled and do not have to pay taxes.\n3. Roads and cities named after people who genocided Hindu\n4. 1991 places of worship act which refuses the Building of Hindu Temples after their demolition\n 5. waqf board which can grab any of your land at anytime and this can include Temples as well\n6. RTE Act which can decide the % reservation of Hindus in Hindu Schools\n7. Drafted (not passed) Communal violence bill which only accuses and persucted Hindus in case of riots. If khangrez was there this would've been passed\n\n*Before India becomes a islamic republic, atleast wake up to reality and when your children ask you why did you not realize the threat of peacefools, don't tell them you were a lazy loser who couldn't sacrifice anything for the next generation or the nation. Thanks!*",
        "*Quran Files (Completely Exposed):*\n1)   2:191 - And kill the unbelievers of Allah wherever you overtake them. Fitnah (rebellion against rightful ruler) is worse than killing.\n2)   2:193 - Fight them until there is no more disbelieving of Islam & until all worship is for Allah alone. \n3)   2:216 - Fighting Jihad against warfare has been ordered upon you. Perhaps you hate it, but it’s good for you. \n4)   2:221 - Do not marry polytheistic women until they believe, And do not marry your women to polytheistic men until they believe.\n5)   2:223 - Your wives are your fields, so go into your fields whichever way you like,and send [something good] ahead for yourselves. \n6)   2:230 - If a man divorces his wife, he shall not remarry her until she has wedded another man and been divorced by him.\n7)   3:4 - Those who disbelieve in the verses of Allah will have a severe punishment.\n8)   3:28 - Muslims! Do not take non-Muslims as friends,unless it is to protect your own selves against them.\n9)   3:142 - You will not enter Paradise before Allah tests those who fought Jihad against in His Cause.\n10)   3:151 - We will cast terror into the hearts of those who disbelieve. \n11)   3:157 - If you are killed in Jihad against in the cause of Allah it is better than anything else in this world.   \n12)   3:169 - Never think of Jihadists who have been killed as dead. They are alive in paradise.   \n13)   3:171 - Jihadi Martyrs receive good rewards and favour from Allah.\n14)   4:15 - Women who have unlawful sex. Lock the guilty women in their houses until they die.\n15)   4:34 - Men are in charge of women. Those wives from whom you fear arrogance - Advise them, forsake them in bed, Finally, beat them.\n16)   4:47 - Jews & Christians disbelieve in Islam, before We destroy your faces & twist them toward their backs & curse you. \n17)   4:56 - Those who disbelieve in Islam , We will drive you into a fire & roast your skins over & over.\n18)   4:75 - What is the matter with you that you do not fight Jihad against (Kafir) in the cause of Allah?\n19)   4:76 - Disbelievers worship Satan. So Muslims! fight against the disbelievers.\n20)   4:89 - Non Muslims wish you would disbelieve like them. Do not be their friend until they emigrate for the cause of Islam. But if they turn away, seize them & kill them wherever you find them. \n21)   4:95 - Allah prefers those who fight Jihad in the Cause of Allah with their lives above those who sit at home.   \n22)   4:101 - The disbelievers of Islam are ever to you a clear enemy. \n23)   5:33 - Those who oppose Islam - Kill them, crucify them. Cut off their hands & feet from opposite sides.\n24)   5:38 - For the thief, the male & the female, cut off their hands.   \n25)   5:60 - Allah turned [the Jews, Christian, Hindus, Buddhist etc] except Islam into apes and pigs.\n26)   6:32 - And the worldly life is not but amusement; but the home of the Hereafter is best for those who fear Allah.\n27)   7:4 - We the Muslim destroyed many cities, Our terror came to them at night & while they were sleeping.\n28)   7:84 - The homosexuals, We rained upon them a rain of stones. Then see how was the end of the criminals.\n29)   7:176 - Non-Muslims are comparable to dogs.\n30)   7:182 - Those who deny Our Quran - We will lead them to destruction from where they do not know.\n31)   8:12 - Terrorise & behead those who do not believe in Islam & strike off their fingertips.\n32)   8:39 - Keep Fighting the disbelievers until there is no more disbelief in Islam.\n33)   8:55 - The worst of living creatures in the sight of Allah are non Muslims. \n34)   8:57 - When you capture the unbeliever of Islam , punish them severely to deter the rest.\n35)   8:67 - Prophet Mohammed! To keep prisoners of war you must inflict a great massacre.\n36)   8:74 - Those who emigrate to an Islamic State & fight Jihad will go to paradise.\n37)   9:5 - And, when the sacred months have passed, kill the polytheists wherever you find them.\n38)   9:29 - Fight unbelievers of Islam (Kafir) Fight them until they give the jizyah Muslim Tax.\n39)   9:30 - Jews and Christians are perverts, may Allah destroy them.   \n40)   9:100 - Praise the Muhajireen fighters (Jihad).\n41)   9:111 - Allah has purchased from the believers their lives & their properties in exchange for paradise.\n42)   9:113 - It is not proper for the believers to pray for forgiveness for the polytheists.\n43)   9:120 - Any act of enraging kafir will be recorded as good deed.\n44)   9:123 - Muslims! Fight those disbelievers next to you and be harsh!\n45)   11:28 - To disbelievers (Kafir )- Should we force Islam upon you? Against your will?\n46)   16:106 - Whichever Muslim leaves Islam, upon you is wrath from Allah, and for you a great punishment.\n47)   22:19 - For those who disbelieve in Islam, garments of fire, boiling water will be poured over their heads. \n48)   22:20 - We will melt your skins and burn your stomach. And hooked rods of iron to punish you.\n49)   23:6 - O Muslims, abstain from sex, except with your wives & slave-girls. Rape with women of non believers of Islam is lawful.\n50)   24:2 - Adulterers - lash each one of them with a hundred lashes, & take no pity for them in the religion of Allah. Let a group of the believers witness their punishment.\n51)   24:29 - Muslims you may enter houses not inhabited, and take goods that you need (i.e Robbery or stealing goods is allowed ) \n52)   25:52 - Do not obey the unbelievers (Kafir ) but launch a great campaign against them with the help of the Quran.\n53)   29:64 - And this worldly life is not only a diversion and amusement, paradise is the real life (Jihad is praised).\n54)   33:26 - Allah cast terror in the hearts of the Jews and Christians.\n55)   33:50 - O Prophet, We have made lawful for you your wives whose bridal dues you have paid and the slave-girls you possess from among the prisoners of war, and the daughters of your paternal uncles and paternal aunts, and the daughters of your maternal uncles and maternal aunts who have migrated with you, and a believing woman who gives herself to the Prophet and whom he wants to take in marriage. this privilege is yours alone to the exclusion of other believers. We know well what restrictions We have imposed upon them as regards their wives and those whom their right hands possess, that there may be no constraint upon you. Allah is Most Forgiving, Most Merciful.\n56)   33:61 - Accursed, wherever found, they shall be seized and killed with a (terrible) slaughter.\n57)   36:67 - And if We willed, We could have deformed them, [paralyzing them] into lifeless objects, in their places so they would not be able to proceed, nor could they return.\n58)   37:23 - Those who worshipped other than Allah, guide them to the path of Hellfire.\n59)   37:38 - Indeed, you disbelievers of Islam (Kafir) will be tasters of the painful punishment.\n60)   40:70-72 - Those who deny the Quran, When the shackles are around their necks & chains; they will be dragged In boiling water; then in the Fire they will be burned.\n61)   41:27 - Therefore We will most certainly make those who disbelieve taste a severe punishment, and We will most certainly reward them for the evil deeds they used to do.\n62)   46:35 - This Quran is notification that all non-Muslims will be destroyed on the day of Judgement.\n63)   47:4 - Those who disbelieve in Islam, strike off their heads. Take them as captives.The command of Allah. But those who are killed in the Way of Allah, He will never let their deeds be lost. \n64)   47:15 - Those who abide eternally in the Fire and are given to drink scalding water that will burn their intestines.\n65)   47:35 - So do not weaken and call for peace while you are superior; and Allah is with you and will never deprive you of your deeds.\n66)   48:13 - And whoever does not believe in Allah and His Messenger, then We surely have prepared for the disbelievers a blazing Fire. \n67)   66:2 - Allah has already ordained for you [believers] the way to absolve yourselves from your oaths.\n68)   66:9 - O Prophet, fight the disbelievers of islam & the hypocrites. Be harsh upon them. Their refuge is Hell.\n69)   70:16 - Disbelievers of Islam, The flame of hell will take away, burning completely, the head skin!   \n70)   98:6 -  Jews and Christians and the Polytheist will be in the fire of Hell. They are the worst of creatures.\n71)   110:1 - When the victory of Allah has come and the conquest.\nShare It To Alteast 100 hindus or keep Posting It Until Achieve Total Collective 1000 likes Target. Don't let This Sharing Chain Break"
    ],
}


def fetch_videos_in_channels_new_cycle():
    while True:
        start_time = datetime.utcnow()

        for channel_id in channel_ids_to_channel_type.keys():
            try:
                youtube = build('youtube', 'v3', developerKey=api_keys[random.randrange(0, len(api_keys))])
                request = youtube.channels().list(id=channel_id, part='contentDetails')
                response = request.execute()
                playlist_id = response['items'][0]['contentDetails']['relatedPlaylists']['uploads']
                res = youtube.playlistItems().list(playlistId=playlist_id,
                                                    part='snippet',
                                                    maxResults=20,
                                                    pageToken=None).execute()

                for video in res['items']:
                    video_published_time = datetime.strptime(video['snippet']['publishedAt'], '%Y-%m-%dT%H:%M:%SZ')
                    current_time = datetime.utcnow()
                    diff_time = current_time - video_published_time

                    if diff_time.total_seconds() > video_fetch_cycle_time:
                        break
                    else:
                        videos.put(video)
            except:
                print('Received exception while retrieving video')

        print(videos.queue)
        end_time = datetime.utcnow()
        sleep_time = video_fetch_cycle_time - (end_time - start_time).total_seconds() - sleep_time_between_polls
        print(sleep_time)
        time.sleep(sleep_time)


def comment_in_videos_in_new_cycle(outh_youtubes):
    while True:
        while videos.empty() is not True:
            video = videos.get()
            channel_type = channel_ids_to_channel_type[video['snippet']['channelId']]
            channel_comments = comments_by_channel_type[channel_type]
            comments = channel_comments if len(channel_comments) <= 2 else random.sample(channel_comments, 2)
            for comment in comments:
                try:
                    channel_number = random.randrange(0, len(outh_youtubes))
                    outh_youtube = outh_youtubes[channel_number]
                    print(channel_number)
                    response = outh_youtube.commentThreads().insert(
                                    part="snippet",
                                    body={
                                        "snippet": {
                                            "videoId": video['snippet']['resourceId']['videoId'],
                                            "topLevelComment": {
                                                "snippet": {
                                                    "textOriginal": comment
                                                }
                                            }
                                        }
                                    }
                                ).execute()

                    comment = response["snippet"]["topLevelComment"]
                    author = comment["snippet"]["authorDisplayName"]
                    text = comment["snippet"]["textDisplay"]
                    print ("Inserted comment for %s: %s: %s" % (author, text, video['snippet']['title']))
                    time.sleep(comment_delay_time)
                except:
                    print('Received Exception')
        print ('Falling asleep for 60 secs')
        time.sleep(60)


def get_oauth_youtube(file):
    os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
    api_service_name = "youtube"
    api_version = "v3"
    
    # Get credentials and create an API client
    flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(file, scopes)
    credentials = flow.run_console()
    youtube = googleapiclient.discovery.build(api_service_name, api_version, credentials=credentials)
    return youtube


oauth_youtubes = []
for file in client_secrets_files:
    oauth_youtubes.append(get_oauth_youtube(file))
Thread(target=fetch_videos_in_channels_new_cycle).start()
Thread(target=comment_in_videos_in_new_cycle, args = (oauth_youtubes, )).start()