1

I'm trying to create a site where, like Digg, a user can submit a link and using ajax it attempts to pull the metadata from the page into a title and description field. The user can change either of these fields then submit the content.

Ideally a module already exists. I tried playing around with Feeds, but I'm not sure if I'm looking in the right place.

I probably have to create my own custom module.

Any suggestions? Can I tap into the Feeds API just to parse the url then take the results and do all the mapping myself? Assuming I want to create my own form and bring in my own ajax.

Ward
  • 3,318
  • 3
  • 30
  • 50

2 Answers2

1

You could probably do that with Feeds, but I think it might be overkill and could be difficult to configure.

You could do what you're looking for in a relatively small custom module using hook_form_alter to customize the submission form, arg() to determine the URL being submitted, drupal_http_request to retrieve the page, then the Form API's #default_value setting to pre-populate the field(s).

The Prepopulate module does a lot of what you're looking for. If it provides hooks (I'm not sure if it does) all you would need to do is add the drupal_http_request, to handle fetching the metadata.

Matt V.
  • 9,703
  • 10
  • 35
  • 56
  • thanks for the tip. I figured something that is a combo of existing and custom modules would be the answer. Any clue on how I can parse the metadata using drupal_http_request – Ward Mar 04 '11 at 21:28
  • 1
    I've heard good things about the Querypath module for that kind of parsing: http://drupal.org/project/querypath p.s. - You might get more responses if you accept some of the answers you've received for your previous questions. – Matt V. Mar 04 '11 at 22:44
  • Seems like this is an easy solution too: get_meta_tags('http:/www.example.com'); – Ward Mar 05 '11 at 01:20
1

In Drupal it's called Drigg ;). It is supposed to a nice Drupal module to get the functionality of Digg. It will be worth a try I suppose.

Gokul N K
  • 2,428
  • 2
  • 32
  • 40