Upload a plain text caption to Youtube - caption

I need to upload plain text file ('*.txt' with 'utf-8' encoding) to youtube via api-v3 and then I plan to auto-sync this caption to get subtitles format from plain text.
Uploading completes with failureReason is unknownFormat and status of caption is 'Track content is not processed.' on web-page
How should I upload plain-text as caption to Auto-sync via api-v3?

Related

How to upload image to Google Drive using MIT APP Inventor II

I'm trying to upload selected image by MIT App Inventor II. What I did is to download an extension which encodes image to base64 coding, and then call Web1 to address Google App Script. Actually, what I did is just follow an YouTube channel, but somehow it does not work.
function doPost(e) {
var data = Utilities.base64Decode(e.parameters.data);
var blob = Utilities.newBlob(data,e.parameters.mimetype,e.parameters.filename);
var folderid = Utilities.base64Decode(e.parameters.folderid);
DriveApp.getFileById(folderid).createFile(blob);
return ContentService.createTextOutput("Your File Successfuly Uploaded");
}
Combining with Taifun's Extension. These blocks are confirmed to be able to do as below.
Display the ImagePicker selected image on the Image component
Encode the ImagePicker selected image to a Base64 string.
Send the string to URL (Google App Script)

Apex - How to download pdf file instead of showing it in the browser?

I'm running Apex 19.2.
I have a pdf stored as blob file in a table. I'm trying to download the blob in a page process.
The process works fine however, the file doesn't download but gets displayed in the browser instead.
Can anyone help please ? I need the file to download and not show in the browser...
Here is my code :
File Blob; -- Blob content is set somewhere else...
sys.HTP.init;
sys.OWA_UTIL.mime_header(MimeType, FALSE);
sys.HTP.p('Content-Length: ' || DBMS_LOB.getlength(File));
sys.HTP.p('Content-Disposition: filename="report.pdf"');
sys.OWA_UTIL.http_header_close;
sys.WPG_DOCLOAD.download_file(file);
apex_application.stop_apex_engine;
Thanks,
Cheers,
Change this line:
sys.HTP.p('Content-Disposition: filename="report.pdf"');
To this:
sys.HTP.p('Content-Disposition: attachment; filename="report.pdf"');
By default this is an individual browser setting, a preference configurable by end users.
https://www.makeuseof.com/tag/download-pdf-files-chrome/
https://answers.microsoft.com/en-us/edge/forum/all/how-to-change-microsoft-edge-to-download-pdf-files/b24dc4b7-14b5-4fe4-85ac-71e28953635e
https://support.mozilla.org/en-US/questions/985483
It does appear that it can be forced through the link/URL that generates the PDF:
Force to open "Save As..." popup open at text link click for PDF in HTML

Open an image in Google Docs

Just a little background: As you might know, if you have an image in Google drive and you try to open it with Google Docs, Google tries to extract the text within your image (OCR) and show the text alongside the image in a newly created Google Docs file.
I am writing a script and within that script I would like to open an image (with some text) with Google Docs.
When I try to do it through the following code, I just an Error message with no explanation on why it fails.
var file_url = file.getUrl();
try
{
var doc = DocumentApp.openByUrl(file_url);
}catch (e) {
Logger.log("Error Occurred: " + e.toString());
}
Any help would be appreciated.
Edit 1: Here is an actual scenario. I have the following .png image and I can open it with Google Docs.
When I open with Google Docs, I get the following document:
Document generated after opening the .png image with Google Doc.
Having the url of this .png file, I would like to do all this through my script so I can have the OCR generated text.
You want to convert a PNG file to Google Document by OCR using Google Apps Script.
If my understanding is correct, how about this modification? In this modification, Drive API is used.
When you use this script, please enable Drive API at Advanced Google Services and API console. You can see about this at here.
Modified script:
var fileId = "### file ID of PNG file ###";
var file = DriveApp.getFileById(fileId);
Drive.Files.insert(
{title: file.getName(), mimeType: MimeType.GOOGLE_DOCS},
file.getBlob(),
{ocr: true}
);
Note:
When the URL of PNG file is like https://drive.google.com/file/d/#####/view?usp=sharing, ##### is the file ID.
In this modified script, the filename of created Document uses the filename of file retrieved by fileId. If you want to use other filename, please modify title: file.getName().
References:
Advanced Google Services
Drive API

Download (TIFF) instead of opening by default in Internet Explorer

We are using Internet Explorer 11. In one of our webpage we got an anchor link which is pointing to a TIFF file. When I click the anchor link by default it is opening in the same page. We want to download (dialog box to save) instead of opening in the same window.
Is there any configuration available in IE?
See the Content-Disposition (RFC-2616) HTTP header, and use the value attachment (as opposed to the default value; inline):
If this header is used in a response [...] the user agent should not display the response, but directly enter a `save response as...' dialog.
Example:
Content-Disposition: attachment; filename="filename.tif"
See also Content-Disposition (MDN):
The first parameter in the HTTP context is either inline (default value, indicating it can be displayed inside the Web page, or as the Web page) or attachment (indicating it should be downloaded; most browsers presenting a 'Save as' dialog, prefilled with the value of the filename parameters if present).

Sending an image from gmail app lose the extension png

Hi I am trying to share some text and image, I use many snnipes of this forum but nothing works. Mi code is the next one:
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("image/png");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "testing email send.");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://com.tortilla.patatapro/drawable/" + Integer.toString(R.drawable.ic_home)));
startActivity(emailIntent);
First it seems that was so easy, but the problem is that when I Share my app with the gmail app and it sends the image and only the subject of the email, then when I open the email the image haven´t got an extension. For example if the image was ic_home.png when I open the email it was something attached with a name like 239378437892 but without extension so the email reader (gmail, hotmail...) doesn´t know what was.
I try to change the code like:
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://com.tortilla.patatapro/drawable/" + R.drawable.ic_home));
or
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://com.tortilla.patatapro/drawable/"+ R.drawable.ic_home + ".png"));
But nothing the email from GMAIL app sends the image without extension, and of course the image was a .png extension.
THANKS!

Resources