├── .gitignore ├── requirements.txt ├── BG ├── 1.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png └── 9.png ├── post.png ├── post1.png ├── post2.png ├── working.gif ├── Post └── post.png ├── chromedriver.exe ├── Font ├── Montserrat-Bold.ttf ├── Montserrat-Thin.ttf ├── Montserrat-Black.ttf ├── Montserrat-Italic.ttf ├── Montserrat-Light.ttf ├── Montserrat-Medium.ttf ├── Montserrat-Regular.ttf ├── Montserrat-ExtraBold.ttf ├── Montserrat-SemiBold.ttf ├── Montserrat-BlackItalic.ttf ├── Montserrat-BoldItalic.ttf ├── Montserrat-ExtraLight.ttf ├── Montserrat-LightItalic.ttf ├── Montserrat-MediumItalic.ttf ├── Montserrat-ThinItalic.ttf ├── Montserrat-SemiBoldItalic.ttf ├── Montserrat-ExtraBoldItalic.ttf └── Montserrat-ExtraLightItalic.ttf ├── forever.py ├── .github └── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── README.MD ├── LICENCE ├── CODE_OF_CONDUCT.md └── content.py /.gitignore: -------------------------------------------------------------------------------- 1 | ## Cache 2 | __pycache__/ 3 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | pillow 2 | requests 3 | bs4 4 | pyautoit 5 | -------------------------------------------------------------------------------- /BG/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/BG/1.png -------------------------------------------------------------------------------- /BG/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/BG/2.png -------------------------------------------------------------------------------- /BG/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/BG/3.png -------------------------------------------------------------------------------- /BG/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/BG/4.png -------------------------------------------------------------------------------- /BG/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/BG/5.png -------------------------------------------------------------------------------- /BG/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/BG/6.png -------------------------------------------------------------------------------- /BG/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/BG/7.png -------------------------------------------------------------------------------- /BG/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/BG/8.png -------------------------------------------------------------------------------- /BG/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/BG/9.png -------------------------------------------------------------------------------- /post.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/post.png -------------------------------------------------------------------------------- /post1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/post1.png -------------------------------------------------------------------------------- /post2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/post2.png -------------------------------------------------------------------------------- /working.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/working.gif -------------------------------------------------------------------------------- /Post/post.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Post/post.png -------------------------------------------------------------------------------- /chromedriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/chromedriver.exe -------------------------------------------------------------------------------- /Font/Montserrat-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-Bold.ttf -------------------------------------------------------------------------------- /Font/Montserrat-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-Thin.ttf -------------------------------------------------------------------------------- /Font/Montserrat-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-Black.ttf -------------------------------------------------------------------------------- /Font/Montserrat-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-Italic.ttf -------------------------------------------------------------------------------- /Font/Montserrat-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-Light.ttf -------------------------------------------------------------------------------- /Font/Montserrat-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-Medium.ttf -------------------------------------------------------------------------------- /Font/Montserrat-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-Regular.ttf -------------------------------------------------------------------------------- /Font/Montserrat-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-ExtraBold.ttf -------------------------------------------------------------------------------- /Font/Montserrat-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-SemiBold.ttf -------------------------------------------------------------------------------- /Font/Montserrat-BlackItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-BlackItalic.ttf -------------------------------------------------------------------------------- /Font/Montserrat-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-BoldItalic.ttf -------------------------------------------------------------------------------- /Font/Montserrat-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-ExtraLight.ttf -------------------------------------------------------------------------------- /Font/Montserrat-LightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-LightItalic.ttf -------------------------------------------------------------------------------- /Font/Montserrat-MediumItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-MediumItalic.ttf -------------------------------------------------------------------------------- /Font/Montserrat-ThinItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-ThinItalic.ttf -------------------------------------------------------------------------------- /Font/Montserrat-SemiBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-SemiBoldItalic.ttf -------------------------------------------------------------------------------- /Font/Montserrat-ExtraBoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-ExtraBoldItalic.ttf -------------------------------------------------------------------------------- /Font/Montserrat-ExtraLightItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LiquidatorCoder/Automatic-Content-Generator/HEAD/Font/Montserrat-ExtraLightItalic.ttf -------------------------------------------------------------------------------- /forever.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | from subprocess import Popen 3 | import sys 4 | 5 | filename = sys.argv[1] 6 | while True: 7 | print("\nStarting " + filename) 8 | p = Popen("python " + filename, shell=True) 9 | p.wait() -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /README.MD: -------------------------------------------------------------------------------- 1 | # Automatic Code Generator 2 | 3 | ## Todo List 4 | 5 | - [x] Fetch a BG. 6 | 7 | - [x] Search for content. 8 | 9 | - [x] Scrape the content. 10 | 11 | - [x] Add name tag. 12 | 13 | - [x] Randomize the content and post a little bit. 14 | 15 | - [x] Generate a caption. 16 | 17 | - [x] Fetch some hashtags and add some of unique hashes. (Not adding unique hashtags.) 18 | 19 | - [x] It should then post this image on most social media platforms. (Instagram for now.) 20 | 21 | - [ ] Everything should be done remotely and without user interference. 22 | 23 | ## Demo 24 | 25 | ![Running Script](/working.gif) 26 | 27 | ![Demo Post](/post.png) 28 | 29 | ![Demo Post 1](/post1.png) 30 | 31 | ![Demo Post 2](/post2.png) -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Additional context** 38 | Add any other context about the problem here. 39 | -------------------------------------------------------------------------------- /LICENCE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Michael Krukov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at maurya.abhay30@gmail.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /content.py: -------------------------------------------------------------------------------- 1 | # ----------------------------- 2 | from PIL import Image 3 | from PIL import ImageFont 4 | from PIL import ImageDraw 5 | from random import randint 6 | import sys 7 | import os 8 | import time 9 | from selenium import webdriver 10 | from selenium.webdriver.common.keys import Keys 11 | from selenium.webdriver.chrome.options import * 12 | import autoit 13 | import numpy as np 14 | # ----------------------------- 15 | from requests import get 16 | from json import loads 17 | # ----------------------------- 18 | # import requests 19 | # from bs4 import BeautifulSoup 20 | # ----------------------------- 21 | # pno = randint(1,10) 22 | # result = requests.get(f'http://quotes.toscrape.com/page/{pno}/') 23 | # page = result.text 24 | # soup = BeautifulSoup(page, 'html.parser') 25 | # quotes = soup.find_all('div', class_='quote') 26 | # scraped = [] 27 | # for quote in quotes: 28 | # text = quote.find('span', class_='text').text 29 | # author = quote.find('small', class_='author').text 30 | # scraped.append([text, author]) 31 | # ----------------------------- 32 | # quotel = [] 33 | # auth = "" 34 | # while len(quotel)>25 or len(quotel)==0: 35 | # qno = randint(0,9) 36 | # quotel = scraped[qno][0] 37 | # quotel = quotel.split(" ") 38 | # auth = f"- {scraped[qno][1]}" 39 | # quote = "" 40 | # c=0 41 | # for i in quotel: 42 | # c+=1 43 | # if c>3: 44 | # quote = quote + "\n" + i + " " 45 | # c = 0 46 | # else: 47 | # quote = quote + i + " " 48 | # quote = quote.replace('“','" ') 49 | # quote = quote.replace('”',' "') 50 | # text = quote + "\n\n" + auth 51 | # ----------------------------- 52 | # def alpha_composite(src, dst): 53 | # ''' 54 | # Return the alpha composite of src and dst. 55 | # 56 | # Parameters: 57 | # src -- PIL RGBA Image object 58 | # dst -- PIL RGBA Image object 59 | # 60 | # The algorithm comes from http://en.wikipedia.org/wiki/Alpha_compositing 61 | # ''' 62 | # http://stackoverflow.com/a/3375291/190597 63 | # http://stackoverflow.com/a/9166671/190597 64 | # src = np.asarray(src) 65 | # dst = np.asarray(dst) 66 | # out = np.empty(src.shape, dtype = 'float') 67 | # alpha = np.index_exp[:, :, 3:] 68 | # rgb = np.index_exp[:, :, :3] 69 | # src_a = src[alpha]/255.0 70 | # dst_a = dst[alpha]/255.0 71 | # out[alpha] = src_a+dst_a*(1-src_a) 72 | # old_setting = np.seterr(invalid = 'ignore') 73 | # out[rgb] = (src[rgb]*src_a + dst[rgb]*dst_a*(1-src_a))/out[alpha] 74 | # np.seterr(**old_setting) 75 | # out[alpha] *= 255 76 | # np.clip(out,0,255) 77 | # astype('uint8') maps np.nan (and np.inf) to 0 78 | # out = out.astype('uint8') 79 | # out = Image.fromarray(out, 'RGBA') 80 | # return out 81 | response = get( 82 | 'http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en') 83 | while len(loads(response.text)) > 10 or len(loads(response.text)) == 0: 84 | response = get( 85 | 'http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en') 86 | text1 = '{quoteText} - {quoteAuthor}'.format(**loads(response.text)) 87 | text1 = text1.split(" ") 88 | c = 0 89 | text = "" 90 | for i in text1: 91 | c += 1 92 | if c > 3: 93 | text = text + "\n" + i + " " 94 | c = 0 95 | else: 96 | text = text + i + " " 97 | text = text.replace(" ", "\n") 98 | # ----------------------------- 99 | x1 = randint(1, 9) 100 | W, H = (1080, 1080) 101 | bg_path1 = os.path.join(os.getcwd(), "BG", f"{x1}.png") 102 | x2 = randint(1, 9) 103 | W, H = (1080, 1080) 104 | bg_path2 = os.path.join(os.getcwd(), "BG", f"{x2}.png") 105 | im1 = Image.open(bg_path1).convert("RGBA") 106 | im2 = Image.open(bg_path2).convert("RGBA") 107 | alpha = randint(0,10)/10 108 | post = Image.blend(im1, im2, alpha) 109 | # re, gr, bl, al = post.split() 110 | # imagelist = [re, gr, bl, post] 111 | # imagerand = randint(1,1) 112 | # post = imagelist[imagerand] 113 | post = post.convert("RGBA") 114 | draw = ImageDraw.Draw(post) 115 | # ----------------------------- 116 | fontlist = ["Montserrat-Black.ttf","Montserrat-BlackItalic.ttf","Montserrat-Bold.ttf","Montserrat-BoldItalic.ttf","Montserrat-ExtraBold.ttf","Montserrat-ExtraBoldItalic.ttf","Montserrat-ExtraLight.ttf","Montserrat-ExtraLightItalic.ttf","Montserrat-Italic.ttf","Montserrat-Light.ttf","Montserrat-LightItalic.ttf","Montserrat-Medium.ttf","Montserrat-MediumItalic.ttf","Montserrat-Regular.ttf","Montserrat-SemiBold.ttf","Montserrat-SemiBoldItalic.ttf","Montserrat-Thin.ttf","Montserrat-ThinItalic.ttf"] 117 | fontnumber = randint(0,17) 118 | fontname = fontlist[fontnumber] 119 | font = ImageFont.truetype( 120 | os.path.join( 121 | os.getcwd(), 122 | "Font", 123 | fontname), 124 | 30) 125 | str = input("Enter the signing name with @ : ") 126 | draw.text((760, 1000), str, (50, 50, 50), font=font) 127 | # ----------------------------- 128 | fontnumber2 = randint(0,17) 129 | fontname2 = fontlist[fontnumber2] 130 | font = ImageFont.truetype( 131 | os.path.join( 132 | os.getcwd(), 133 | "Font", 134 | fontname2), 135 | 70) 136 | w, h = draw.textsize(text, font=font) 137 | draw.text(((W - w) / 2, (H - h) / 2), text, (30, 30, 30), font=font) 138 | # ----------------------------- 139 | post.save(os.path.join(os.getcwd(), "Post", "post.png")) 140 | # ----------------------------- 141 | 142 | options = Options() 143 | options.add_argument("--log-level=3") 144 | options.add_argument("--silent") 145 | #options.add_argument("--headless") 146 | options.add_argument("--no-sandbox") 147 | options.add_argument("--disable-logging") 148 | options.add_argument("--mute-audio") 149 | #mobile_emulation = {"deviceName": "Nexus 5"} 150 | #options.add_experimental_option("mobileEmulation", mobile_emulation) 151 | options.add_argument('--user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1') 152 | 153 | # ----------------------------- 154 | 155 | browser = webdriver.Chrome(r"chromedriver.exe",options=options) 156 | username = 'motivation.py' 157 | password = '30june2000' 158 | browser.get('https://www.instagram.com/accounts/login/') 159 | 160 | n = randint(3,5) 161 | time.sleep(n) 162 | usernameInput = browser.find_elements_by_css_selector('form input')[0] 163 | passwordInput = browser.find_elements_by_css_selector('form input')[1] 164 | 165 | usernameInput.send_keys(username) 166 | passwordInput.send_keys(password) 167 | passwordInput.send_keys(Keys.ENTER) 168 | n = randint(3,5) 169 | time.sleep(n) 170 | browser.find_element_by_xpath("/html/body/div[1]/section/main/div/button").click() 171 | n = randint(2,5) 172 | time.sleep(n) 173 | browser.find_element_by_xpath("/html/body/div[4]/div/div/div[3]/button[2]").click() 174 | # while 1: 175 | # time.sleep(1) 176 | # try: 177 | # driver.find_element_by_xpath("/html/body/div[4]/div/div/div[3]/button[2]").click() 178 | # break 179 | # except: 180 | # pass 181 | n = randint(2,5) 182 | time.sleep(n) 183 | browser.find_element_by_xpath("/html/body/div[1]/section/nav[2]/div/div/div[2]/div/div/div[3]").click() 184 | autoit.win_active("Open") #open can change by your os language if not open change that 185 | n = randint(2,5) 186 | time.sleep(n) 187 | autoit.control_send("Open", "Edit1", os.path.join(os.getcwd(), "Post", "post.png")) 188 | n = randint(2,5) 189 | time.sleep(n) 190 | autoit.control_send("Open", "Edit1", "{ENTER}") 191 | n = randint(2,5) 192 | time.sleep(n) 193 | browser.find_element_by_xpath("/html/body/div[1]/section/div[1]/header/div/div[2]/button").click() 194 | n = randint(2,5) 195 | time.sleep(n) 196 | caption = text.replace("\n", " ") 197 | caption = caption + "\n.\n.\n.\n.\n.\n.\n.\n.\n#motivation #getstarted #nevergiveup #dontgiveup #happy #life #goals" 198 | browser.find_element_by_xpath("//*[@id='react-root']/section/div[2]/section[1]/div[1]/textarea").send_keys(caption) 199 | n = randint(2,5) 200 | time.sleep(n) 201 | browser.find_element_by_xpath("/html/body/div[1]/section/div[1]/header/div/div[2]/button").click() 202 | n = randint(5,7) 203 | time.sleep(n) 204 | #browser.close() --------------------------------------------------------------------------------