Skip to content

Instantly share code, notes, and snippets.

@Nub
Created November 15, 2011 09:43
Show Gist options
  • Select an option

  • Save Nub/1366582 to your computer and use it in GitHub Desktop.

Select an option

Save Nub/1366582 to your computer and use it in GitHub Desktop.
void getImageUrlForCallsign(NSString *callsign){
NSString *searchURL = [NSString stringWithFormat:@"http://www.bing.com/images/search?q=%@+logo&go=&qs=n&sk=&sc=8-4&form=QBIR", callsign];
NSString *regexOneliner = [NSString stringWithFormat:@"/usr/local/bin/wget -O tmp.txt \"%@\";sleep 2;cat tmp.txt | perl -ne '/class=\"sg_t\" src=\"([^>]*)\" style=\"([^>]*)\"/; print \"$1,\" ' >> tmp2.txt;echo '\"%@\":\"' >> allText.json; cat tmp2.txt | perl -ne '/,*(http[^,]*).*/; print \"$1\"' >> allText.json;echo '\",' >> allText.json;echo 'Done'; rm tmp.txt; rm tmp2.txt",
searchURL, callsign];
//NSLog(regexOneliner);
system([regexOneliner UTF8String]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment