Scraping Instagram Photos - import.io

Trying to do http://support.import.io/knowledgebase/articles/389408-infinite-scroll-without-prerender to scrape instagram photos but can't seem to find the URL.
Anyone know how to do this?

Another way to do it is understand how Instagram handles the infinite scroll. When you hit the bottom of the page, a new request is sent to the server.
This is a POST request to https://www.instagram.com/query/ passing the following structure as argument:
q:ig_me() {
feed {
media.after(1207458316004284237, 12) {
nodes {
id,
caption,
code,
comments.last(4) {
count,
nodes {
id,
created_at,
text,
user {
id,
profile_pic_url,
username
}
},
page_info
},
date,
dimensions {
height,
width
},
display_src,
is_video,
likes {
count,
nodes {
user {
id,
profile_pic_url,
username
}
},
viewer_has_liked
},
location {
id,
has_public_page,
name
},
owner {
id,
blocked_by_viewer,
followed_by_viewer,
full_name,
has_blocked_viewer,
is_private,
profile_pic_url,
requested_by_viewer,
username
},
usertags {
nodes {
user {
username
},
x,
y
}
},
video_url
},
page_info
}
},
id,
profile_pic_url,
username
}
ref:feed::show
This piece of data media.after(1207458316004284237, 12) is actually what tells to the server what to return next and it is the identifier of the last post in the feed. It is basically telling "give me 12 new posts after the post with ID 1207458316004284237"

Related

TypeORM select data from nested relations

Using
await this.budgetRepository.createQueryBuilder("budget")
.leftJoinAndSelect("budget.contact", "contact")
.leftJoinAndSelect("contact.photo", "contactPhoto")
.getMany();
I get a list with objects like this:
Budget {
id: 1,
unnecessary_property1: something,
contact: Contact {
unnecessary_property2: something,
photo: Photo {
unnecessary_property3: something,
url: "url.com"
},
},
}
But I want to select only the necessary properties in the nested objects (relations) and get a list of objects like this:
Budget {
id: 1,
contact: Contact {
photo: Photo {
url: "url.com"
},
},
}
How is that possible with TypeORM?
This is possible but we have to select everything manually with .select()
await this.budgetRepository.createQueryBuilder("budget")
.leftJoinAndSelect("budget.contact", "contact")
.leftJoinAndSelect("contact.photo", "contactPhoto")
.select(['budget.id', 'contactPhoto.url']
.getMany();
If you're using repository pattern that you will be achieve the similar result with:
await this.budgetRepository.find({
relations: ["contact", "contact.photo"]
})
You would have to use the .select() function and pass the given properties you want for each entity.
for your example:
const user = await createQueryBuilder("budget")
.leftJoinAndSelect("budget.contact", "contact")
.leftJoinAndSelect("contact.photo", "contactPhoto")
.select([/* everything from budget */, 'contact.photo.url'....]) // added selection
.getMany();

Fetching nearest events with user location using meetup.com GraphQL API

I am trying to find out a way to fetch nearby events using GraphQL meetup.com API. After digging into the documentation for quite some time, I wasn't able to find a query that suits my needs. Furthermore, I wasn't able to find old, REST, documentation, where, the solution for my case might be present.
Thanks in advance !
This is what I could figure out so far, the Documentation for SearchNode is missing, but I could get id's for events:
query($filter: SearchConnectionFilter!) {
keywordSearch(filter: $filter) {
count
edges {
cursor
node {
id
}
}
}
}
Input JSON:
{ "filter" : {
"query" : "party",
"lat" : 43.8,
"lon" : -79.4, "radius" : 100,
"source" : "EVENTS"
}
}
Hope that helps. Trying to figure out this new GraphQL API
You can do something like this (customize it with whatever fields you want from Event):
const axios = require('axios');
const data = {
query: `
query($filter: SearchConnectionFilter!) {
keywordSearch(filter: $filter) {
count
edges {
cursor
node {
id
result {
... on Event {
title
eventUrl
description
dateTime
going
}
}
}
}
}
}`,
variables: {
filter: {
query: "party",
lat: 43.8,
lon: -79.4,
radius: 100,
source: "EVENTS",
},
},
};
axios({
method: "post",
url: `https://api.meetup.com/gql`,
headers: {
Authorization: `Bearer YOUR_OAUTH_ACCESS_TOKEN`,
},
data,
})

How to use TokenDayData in Uniswap

I am using uniswap v2 subgraph to get data. TokenDayData lets you search historically. I'm trying to query historical data for a token with this query:
{
tokenDayData(id: "0x56143e2736c1b7f8a7d8c74707777850b46ac9af-19086.058842592593") {
token {
id
}
}
}
and getting the response:
"data": {
"tokenDayData": null
}
How can I get real data?
I was just trying this myself and got this to work:
{
tokenDayDatas(
where: {
token: "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
date_gt: 1661717376
},
orderBy: date,
orderDirection: asc) {
date
token {
id
symbol
}
volumeUSD,
untrackedVolumeUSD,
priceUSD,
open,
high,
low,
close
}
}
some of the examples here helped: https://docs.uniswap.org/sdk/subgraph/subgraph-examples
looks like you're using "tokenDayData" (which is what I used initially), but notice the working query uses "tokenDayDatas" (which is odd, but whatever)

Query works in GraphIQL, but not in Relay Classic

I am trying to make a query to get a list of participants. In GraphiQL, this works. However, on the front end with React-Native/RelayClassic, the query only returns one participants
In GraphiQL:
query getJobInfo ($sessionToken: String!, $jobId: String!) {
viewer(sessionToken: $sessionToken){
job(jobId: $jobId){
jobId
title
participants(first: 1000) {
edges {
node {
userId
firstName
lastName
profilePic
}
}
}
}
}
}
where edges returns many participants
In RelayClassic:
const RelayCompletionPeople =
Relay.createContainer(UnconnectedCompletionPeople, {
initialVariables: {
jobId: "abcd123",
},
fragments: {
viewer: () => Relay.QL`
fragment on Viewer {
job(jobId: $jobId) {
jobId
title
participants (first: 1000) {
edges {
node {
userId
firstName
lastName
profilePic
}
}
}
}
}
`
}
});
where edges returns only one participant
What it is that is causing this to happen?
Are there other places in my code that I need to look in order to return a list?
Any help would be greatly appreciated! I've been stuck on this for quite awhile.
Update:
I found the issue. There was a parent relay container that conflicted with the number of participants that could reach the completionPeople container.

Instagram API - How to get more than 20 overall results, even with pagination?

I'm creating a React Native app that calls the Instragram API to get the latest posts from a specific user. I use the pagination to get 6 posts every reload. I understand that when you call this:
https://api.instagram.com/v1/users/self/media/recent/?access_token=ACCESS-TOKEN&count=COUNT
If given anything 20 or over for COUNT will default to the maximum results of 20. For my case, I only request for 6 while giving it the last id of the oldest dated post from the previous pagination call as the MAX_ID.
All of this works fine until I start getting trying to get anything past the 20th most recent post. So, for example, here is the network results I get:
users/self/media/recent/?access_token=ACCESS-TOKEN&count=6 => {
data: {
[ ..., id: "12345"] // length of 6
},
pagination: {
next_max_id: "12345"
}
}
users/self/media/recent/?access_token=ACCESS-TOKEN&count=6&MAX_ID=12345 => {
data: {
[ ..., id: "67890"] // length of 6
},
pagination: {
next_max_id: "67890"
}
}
users/self/media/recent/?access_token=ACCESS-TOKEN&count=6&MAX_ID=67890 => {
data: {
[ ..., id: "34567"] // length of 6
},
pagination: {
next_max_id: "34567"
}
}
users/self/media/recent/?access_token=ACCESS-TOKEN&count=6&MAX_ID=34567 => {
data: {
[ ..., id: "89012"] // length of 2
},
pagination: {
next_max_id: "89012"
}
}
users/self/media/recent/?access_token=ACCESS-TOKEN&count=6&MAX_ID=89012 => {
data: {
[ ] // length of 0
},
pagination: { } // this is an empty object
}
All the requests (except the last two) are correct and give me valid data for me to use in my app.
Unless I'm misunderstanding how the API works, those last two requests should have given me 6 posts in the data response each, but instead, it gave me 2 and 0 respectively.
What am I doing wrong? How can I get this to properly paginate and consistently keep getting the next 6 posts?
Thanks!
If you are in Sandbox mode (which it sounds like you are), you will only be allowed to get the 20 most recent posts, even if you give it the pagination.