Skip to content

Instantly share code, notes, and snippets.

View EsteveSegura's full-sized avatar
❄️
Focusing

Esteve Segura EsteveSegura

❄️
Focusing
View GitHub Profile
@EsteveSegura
EsteveSegura / .env
Created September 27, 2019 22:44
.env for tools-for-instagram
IG_USERNAME=userInstagram
IG_PASSWORD=**********
@EsteveSegura
EsteveSegura / .js
Created September 28, 2019 10:49
simple login in tfi
const tfi = require('tools-for-instagram'); //require of tools-for-instagram
//login in instagram
let ig = login();
@EsteveSegura
EsteveSegura / .js
Created September 28, 2019 11:29
tfi and simple structure
const tfi = require('tools-for-instagram');
//tfi doing login
let ig = login();
//hashtags on which we are going to act
const hashtags =[
"vegan",
"vegetarian",
"govegan",
@EsteveSegura
EsteveSegura / .js
Created September 28, 2019 11:31
tfi and sample structure
const tfi = require('tools-for-instagram');
//tfi doing login
let ig = await login();
//hashtags on which we are going to act
const hashtags =[
"vegan",
"vegetarian",
"govegan",
@EsteveSegura
EsteveSegura / .js
Created September 28, 2019 13:39
get all hashtags
//we create a function to get all the hashtags we want
async function getPostsFromHashtags(ig,arrayOfHashtags){
//Create an empty array to store all hashtags
let allPosts = []
//We go through the entire list of hashtags and add it to our empty array
for(let i = 0 ; i < arrayOfHashtags.length ; i++){
let hashtagActual = await recentHashtagList(ig,arrayOfHashtags[i])
allPosts.push(hashtagActual)
}
@EsteveSegura
EsteveSegura / .js
Created September 28, 2019 13:44
tfi instagram structute
const tfi = require('tools-for-instagram');
//hashtags on which we are going to act
const hashtags =[
"vegan",
"vegetarian",
"govegan",
"veganfood",
"organic",
]
@EsteveSegura
EsteveSegura / .js
Created September 28, 2019 13:57
random int generator
/*
This function generates a random number between a minimum and a maximum
including the extremes within the returned range
*/
function randomIntInc(min, max) {
return Math.floor(Math.random() * (max - min + 1) + min)
}
@EsteveSegura
EsteveSegura / .js
Created September 28, 2019 14:47
like randomly
//Get all post from hashtags
let allPosts = await getPostsFromHashtags(ig,hashtags)
/*
We go through the entire array to find photos
randomly and also like with an irregular interval
between 3 seconds and 220 seconds
*/
for(let i = 0 ; i < likesPerInterval ; i++){
await sleep(randomIntInc(3,220))
likeMediaId(ig,allPosts[randomIntInc(0,allPosts.length)].pk)
//we create a function to get all the hashtags we want
async function getPostsFromHashtags(ig,arrayOfHashtags){
//Create an empty array to store all hashtags
let allPosts = []
//We go through the entire list of hashtags and add it to our empty array
for(let i = 0 ; i < arrayOfHashtags.length ; i++){
let hashtagActual = await recentHashtagList(ig,arrayOfHashtags[i])
allPosts.push(hashtagActual)
}
@EsteveSegura
EsteveSegura / .js
Created September 28, 2019 15:19
follow by interval
//Get all users from hashtags
let allPosts = await getPostsFromHashtags(ig,hashtags)
/*
We go through the entire array to users
randomly and also follow with an irregular interval
between 3 seconds and 220 seconds
*/
for(let i = 0 ; i < followsPerInterval ; i++){
await sleep(randomIntInc(3,220))
followUser(ig,allPosts[randomIntInc(0,allPosts.length)].user.pk)