Spaces:
Running
Running
File size: 4,896 Bytes
feb81a3 b53d3b2 b81aee2 b53d3b2 feb81a3 4cbf1b4 feb81a3 30e276c feb81a3 4cbf1b4 feb81a3 |
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 |
const { iwaTag, iwa, iwaId, iwaIdUrl } = require('instagram-without-api-node');
const _cookie = process.env.COOKIE // <!-- required!! please get your cookie from your browser console (6)
const _userAgent = process.env.USER_AGENT // <!-- required!! please get your user-agent from your browser console (7)
const _xIgAppId = process.env.APPID // <!-- required!! please get your x-ig-app-id from your browser console (8)
// get the latest 12 feeds from a tag (example https://instagram.com/explore/tags/love)
async function insta_iwaTag(tag) {
const responseIwaTag = await iwaTag({
group: 'recent', // <!-- "recent" images or "top" images; "recent" is by default
base64images: true, // <!-- optional, but without you will be not able to save images.. it increases the size of the json file
base64imagesCarousel: false, // <!-- optional but not recommended, it increases the size of the json file
base64videos: false, // <!-- optional but not recommended, it increases the size of the json file
headers: {
'cookie': _cookie,
'user-agent': _userAgent,
'x-ig-app-id': _xIgAppId
},
maxImages: 2, // <!-- optional, 12 is the max number
file: "instagram-cache-bytag.json", // <!-- optional, instagram-cache.json is by default
pretty: true, // <!-- optional, prettyfy json true/false
time: 3600, // <!-- optional, reload contents after 3600 seconds by default
id: tag // <!-- id is required
})
return responseIwaTag
}
// get the latest 12 feeds from an account (example https://www.instagram.com/orsifrancesco/)
async function insta_iwa(username) {
const responseIwa = await iwa({
base64images: true, // <!-- optional, but without you will be not able to save images.. it increases the size of the json file
base64imagesCarousel: false, // <!-- optional but not recommended, it increases the size of the json file
base64videos: false, // <!-- optional but not recommended, it increases the size of the json file
headers: {
'cookie': _cookie,
'user-agent': _userAgent,
'x-ig-app-id': _xIgAppId
},
maxImages: 2, // <!-- optional, 12 is the max number
file: "../tmp/instagram-cache.json", // <!-- optional, instagram-cache.json is by default
pretty: true, // <!-- optional, prettyfy json true/false
time: 3600, // <!-- optional, reload contents after 3600 seconds by default
id: username // <!-- id is required
})
return responseIwa
}
// get picture and info from instagram id url (example https://www.instagram.com/p/Cgczi6qMuh1/)
async function insta_iwaIdUrl(id) {
const responseIwaIdUrl = await iwaIdUrl({
headers: {
'cookie': _cookie,
'user-agent': _userAgent,
'x-ig-app-id': _xIgAppId
},
base64images: false, // <!-- optional, but without it, you will be not able to store/show images
file: "instagram-cache-byidurl.json", // <!-- optional, instagram-cache.json is by default
pretty: true, // <!-- optional, prettyfy json true/false
time: 3600, // <!-- optional, reload contents after 3600 seconds by default
id: id // <!-- id is required
})
return responseIwaIdUrl
}
// get picture and info from instagram id (2890411760684296309 is the id of https://www.instagram.com/p/Cgczi6qMuh1/)
async function insta_iwaId(id) {
const responseIwaId = await iwaId({
base64images: true, // <!-- optional, but without you will be not able to save images.. it increases the size of the json file
base64videos: false, // <!-- optional but not recommended, it increases the size of the json file
headers: {
'cookie': _cookie,
'user-agent': _userAgent,
'x-ig-app-id': _xIgAppId
},
file: "instagram-cache-byid.json", // <!-- optional, instagram-cache.json is by default
pretty: true, // <!-- optional, prettyfy json true/false
time: 3600, // <!-- optional, reload contents after 3600 seconds by default
id: id // <!-- id is required
})
return responseIwaId
}
module.exports = { insta_iwaId, insta_iwaIdUrl, insta_iwa, insta_iwaTag }
|