I was going through Twitter Web Pages for my project. Found this problem.
E.g.
Web Page:https://twitter.com/SrBachchan
Page Source(when viewed in the browser by Right Clicking) :
view-source:https://twitter.com/SrBachchan
Downloaded the source code by curl command. The downloaded source code(through curl) is different from the original source code.
I tried downloading the source code using python also(used urllib2.urlopen). Its the same as obtained by curl.
Can anyone throw some light on this.?
I found the solution myself.
One needs to add the header '--header "Accept-Language: en" ' for getting the exact source code of the language.
E.g. curl --header "Accept-Language: en" https://twitter.com/SrBachchan would do the job.
Related
So, to confirm: I believe I have set everything up correctly as I was able to run the sample code for the recognize-long-running method. It quickly returned a name and a json file with the transcription.
However, when I try to run the same code for my own audio sample, nothing happens. The API dashboard shows that a request came through, but my Terminal hangs with no response. I am using a Mac, High Sierra 10.13.6, and running the code from the command line. I also have a project set up in Google Cloud Platform and have the file in question uploaded in flac format. Noteworthy, perhaps: my sample has a bitrate of 48000, which is higher than their recommended one, so perhaps this is messing things up?
I will paste the sample code that works below, in addition to my code.
Working sample code from Google:
gcloud ml speech recognize-long-running \
'gs://cloud-samples-tests/speech/brooklyn.flac' \
--language-code='en-US' --async
My code:
gcloud ml speech recognize-long-running \ 'gs://interviewtexttospeechconversions/MelvinWeek4.flac’ \
--language-code='en-US' --async --
I think that your terminal is getting hang with no response since you are using a (`) character to close the file name quote instead of the (') character. Additionally, I think is required to remove the -- symbol, located at the end of the gcloud command, in case you are not planning to add another parameter.
gcloud ml speech recognize-long-running 'gs://interviewtexttospeechconversions/MelvinWeek4.flac' --language-code='en-US' --async
Finally, I recommend you to include the sample-rate and encoding parameters that can help you to avoid invalid configuration issues.
http://my.domain/path/to/file/%E7%8D%85%E5%AD%90%E9%A0%AD.jpg?1371377932
This works just fine.
The browser knows to convert this to 獅子頭.
http://mycdn.cloudfront.net/path/to/file/%E7%8D%85%E5%AD%90%E9%A0%AD.jpg?1371377932
I get this error
ERROR
The request could not be satisfied.
CloudFront wasn't able to connect to the origin.
Generated by cloudfront (CloudFront)
Request ID:
I don't know if you tried it yet, but you could try the Japanese characters instead of their equivalent in unicode. I tested a video name with Russian characters and it worked without problems.
AWS normally supports most character sets.
This is what I did: http://dxxxxx.cloudfront.net/Учебная-программа.mp4
However, it may be possible that it does not work via a CNAME. I never tested that.
You could try to do a curl request like this:
curl -I -H "Host: my.domain" http://mycdn.cloudfront.net/path/to/file/%E7%8D%85%E5%AD%90%E9%A0%AD.jpg?1371377932
That's usually the easiest way to test if your cdn works. There's a -I option in curl to just display the headers. Check if you're getting a 200 statuscode, and not a 404 or other strange responses.
In general dns changes might take time to be fully delegated throughout the internet. Checking can be done with tools like these: https://www.whatsmydns.net
I have a Rails app that has a Picture model using the carrier-wave gem to handle image upload/saving.
Eventually, I plan to have an iOS app POST an image to the Picture model's controller / create action.
Before that, I'd like to test some things locally and simulate the POST event.
Can I do this by encoding/posting via OSX Terminal? I imagine I need to encode the image file into (binary?) and POST it to the controller/action.
The easiest way to simulate this is using the command line utility curl. You can do something like:
curl -X POST -F field1=value1 -F file=#path/to/file.jpg http://example.org/pictures
The -F options allow you to set form field values. For example, your controller might be expecting that a couple form fields will be submitted with the file upload. You can pass in multiple -F name=value options. If the value starts with a #, then curl will read from a file (such as the image you want to upload).
The -X POST makes curl run a POST request to the server. I'm not 100% sure it is necessary, because I think curl will automatically switch to POST since you've included a file with the upload... but it won't hurt anything either.
curl is a very powerful tool. You can get additional information by typing man curl in your OSX Terminal window. It has a lot of options and can handle just about any situation you throw at it.
Is there a way to make Facebook re-parse a page to get the updated open graph object?
I know about the linter debug tool but I was wondering if there's an API or something to do it programmatically.
According to the Facebook documentation located at https://developers.facebook.com/docs/technical-guides/opengraph/defining-an-object/ under "Updating Objects"
curl -X POST \
-F "id={object-url OR object-id}" \
-F "scrape=true" \
"https://graph.facebook.com"
all you have to do is hit http://developers.facebook.com/tools/debug/og/object?q={escaped URL} with an authorized session.
I had to re-lint a couple thousand URLs so printed them out as basic links and then used a browser plugin to download them all so it only ended up taking 15 mins.
I have looked all over the internet, mygenteration's forum, and mygenteration's website and I cannot figure out how to pass parameters into a template through the command line using the xmldatapath switch. Does anyone know how to do this?
--edit--
I did a little research and here is a summary of the format of xml input for MyGeneration.
Have you seen this post, which indicates that the -i xmldatapath works with a saved output file created by MyGeneration itself. You don't detail what your exact issue is, have you tried using -c to create the file that you then use with -i? If you're still having issues add some more detail and I'll run up MyGeneration from the source and see what's going on.