Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 700877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:32:50+00:00 2026-05-14T03:32:50+00:00

I am trying to upload a youtube video using the GData gem (I have

  • 0

I am trying to upload a youtube video using the GData gem (I have seen the youtube_g gem but would like to make it work with pure GData if possible), but I keep getting this error:

GData::Client::BadRequestError in ‘MyProject::Google::YouTube should upload the actual video to youtube (once it does, mock this test out)’
request error 400: No file found in upload request.

I am using this code:


def metadata
  data = <<-EOF
<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"
  xmlns:media="http://search.yahoo.com/mrss/"
  xmlns:yt="http://gdata.youtube.com/schemas/2007">
  <media:group>
    <media:title type="plain">Bad Wedding Toast</media:title>
    <media:description type="plain">
      I gave a bad toast at my friend's wedding.
    </media:description>
    <media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">People</media:category>
    <media:keywords>toast, wedding</media:keywords>
  </media:group>
</entry>
EOF
end

@yt = GData::Client::YouTube.new
@yt.clientlogin("name", "pass")
@yt.developer_key = "myKey"
url = "http://uploads.gdata.youtube.com/feeds/api/users/name/uploads"
mime_type = "multipart/related"
file_path = "sample_upload.mp4"
@yt.post_file(url, file_path, mime_type, metadata)

What is the recommended/standard way for uploading videos to youtube with ruby, what is your method?

Update

After applying the changes to wrapped_entry, the string it produces looks like this:


--END_OF_PART_59003
Content-Type: application/atom+xml; charset=UTF-8
<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"
  xmlns:media="http://search.yahoo.com/mrss/"
  xmlns:yt="http://gdata.youtube.com/schemas/2007">
  <media:group>
    <media:title type="plain">Bad Wedding Toast</media:title>
    <media:description type="plain">
      I gave a bad toast at my friend's wedding.
    </media:description>
    <media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat">People</media:category>
    <media:keywords>toast, wedding</media:keywords>
  </media:group>
</entry>

--END_OF_PART_59003
Content-Type: multipart/related
Content-Transfer-Encoding: binary

… and inspecting the request and response looks like this:

Request:


<GData::HTTP::Request:0x1b8bb44 @method=:post
@url="http://uploads.gdata.youtube.com/feeds/api/users/lancejpollard/uploads"
@body=#<GData::HTTP::MimeBody:0x1b8c738 @parts=[#<GData::HTTP::MimeBodyString:0x1b8c058 @bytes_read=0
@string="--END_OF_PART_30909\r\nContent-Type: application/atom+xml; charset=UTF-8\r\n\r\n
<?xml version=\"1.0\"?>\n<entry xmlns=\"http://www.w3.org/2005/Atom\"\n  xmlns:media=\"http://search.yahoo.com/mrss/\"\n  xmlns:yt=\"http://gdata.youtube.com/schemas/2007\">\n  <media:group>\n    <media:title type=\"plain\">Bad Wedding Toast</media:title>\n    <media:description type=\"plain\">\n      I gave a bad toast at my friend's wedding.\n    </media:description>\n    <media:category scheme=\"http://gdata.youtube.com/schemas/2007/categories.cat\">People</media:category>\n    <media:keywords>toast
wedding</media:keywords>\n  </media:group>\n</entry>
\n\r\n--END_OF_PART_30909\r\nContent-Type: multipart/related\r\nContent-Transfer-Encoding: binary\r\n\r\n">
#<File:/Users/Lance/Documents/Development/git/thing/spec/fixtures/sample_upload.mp4>
#<GData::HTTP::MimeBodyString:0x1b8c044 @bytes_read=0
@string="\r\n--END_OF_PART_30909--">]
@current_part=0
@boundary="END_OF_PART_30909">
@headers={"Slug"=>"sample_upload.mp4"
"User-Agent"=>"GoogleDataRubyUtil-AnonymousApp"
"GData-Version"=>"2"
"X-GData-Key"=>"key=AI39si7jkhs_ECjF4unOQz8gpWGSKXgq0KJpm8wywkvBSw4s8oJd5p5vkpvURHBNh-hiYJtoKwQqSfot7KoCkeCE32rNcZqMxA"
"Content-Type"=>"multipart/related; boundary=\"END_OF_PART_30909\""
"MIME-Version"=>"1.0"}>

Response:


#<GData::HTTP::Response:0x1b897e0 @body="No file found in upload request."
@headers={"cache-control"=>"no-cache
no-store
must-revalidate"
"connection"=>"close"
"expires"=>"Fri
01 Jan 1990 00:00:00 GMT"
"content-type"=>"text/plain; charset=utf-8"
"date"=>"Fri
11 Dec 2009 02:10:25 GMT"
"server"=>"Upload Server Built on Nov 30 2009 13:21:18 (1259616078)"
"x-xss-protection"=>"0"
"content-length"=>"32"
"pragma"=>"no-cache"}
@status_code=400>

Still not working, I’ll have to check it out more with those changes.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:32:50+00:00Added an answer on May 14, 2026 at 3:32 am

    Not sure if you ever fixed this, but I believe the mime_type param in post_file should be set to the mime_type of the video – you’ve got it set to “multipart/related” in your sample code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to upload my SYmfony plugin for some time but I
I am trying to upload a file via ftp using FtpWebRequest as below: ftpRequest
I am trying to upload a file to some url using ssl. I use
I am trying to upload my app on itunes. For that I have created
I am trying to upload files using php, and it works perfectly up until
I am trying to upload a file via a form and then save in
I'm trying to upload Excel (2003) file into Sql server 2005. At present we
I've been trying to upload an APK file to the Android Market for a
I am trying to upload an image through my application with Facebook Graph API
Ok I been Googling for a while now, and i can't seem to find

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.