I’d like to write a code about data scrapping from internet
I set the target as downloading my facebook images and friends list, but It seems too hard for me
So now I’m trying to make easy sample that download google Log image from interet(like google.com ), and search some words at google
I thought I could communicate with google’s IP with port number, but I don’t know what kind of libraries and functions are needed.
Any little tips will be very helpful to me. Please note me any tip please!
1 Like
Kevin
February 13, 2019, 10:09pm
2
You’re looking for something called an API .
For example Facebook has a bunch of APIs that give you programmatic access to Facebook data:
https://developers.facebook.com/docs/apis-and-sdks/
1 Like
Thank you for tip!
I think I should learn about standard comunication rules.
Thankyou again!
kll
February 14, 2019, 6:39am
4
following example is actually not too useful,
unless it shows the use of
with internet urls.
String[] incoming;
int srcindex, srcend;
String line,picsrc;
PImage found;
boolean foundone = false;
void setup() {
size(400,400);
incoming = loadStrings("https://google.com");
//printArray(incoming);
for (int i=0; i<incoming.length; i++) {
srcindex=0;
srcend=0;
line = incoming[i];
srcindex = line.indexOf("src=");
srcend = line.indexOf(".png"); // search png files only
if ( srcindex > 0 && srcend > 0 && srcend > srcindex) {
println("i "+i+" srcindex "+srcindex+" srcend "+srcend);
picsrc = "https://www.google.com"+line.substring(srcindex+5, srcend)+".png"; // not use src="
println(picsrc);
found = loadImage(picsrc);
foundone = true;
}
}
}
void draw() {
if ( foundone ) image(found,0,0);
}
1 Like
Thank you very much!
Code is so good and clean so I could understand various knowledges
I Think I should study more about HTML,XML,JSON structure, so then I’ll get informations of target page & ask to server to give me the needed data.