I've been pretty fascinated by what's going on at BlogShares lately, so I figured I'd write a little plugin I could use to access my blog's current value.
And here it is. It's not much of a plugin so far, it's mostly just a little hack to download the tracking page for the current (or a given) blog and throw a couple of perl patterns at the results to pull out the data.
Download one of the following files, unpack it, and place blogshares.pl in your plugins/ directory.
It provides the following tags:
- MTBlogShares
- container tag
- takes one optional argument, blog_url, to specify the url to check at BlogShares, which defaults to the url of the current blog
- MTBlogSharesPrice
- The blog's current stock price
- MTBlogSharesPE
- The blog's current P/E ratio
Usage Example:
<MTBlogShares>
Price: <MTBlogSharesPrice><br />
P/E Ratio: <MTBlogSharesPE><br />
</MTBlogShares>
Minor Update: (2003-04-02 13:54)
- Changed the behavior of MTBlogShares. If there is a problem contacting the BlogShares site, MTBlogShares now returns an empty string instead of erroring out. That should fix most people's problems with the plugin and the state of the site at the moment.
Update: (2003-04-04 13:46)
- I added a new container tag, MTBlogSharesUser, that can be used to access data for your account (instead of for your site). It takes one required argument, id, for your user id at BlogShares.
- Within MTBlogSharesUser, you can use the MTBlogSharesTotalPortfolio to access the total vaue of your portfolio.
- I may add other tags this weekend (including what stocks you own, etc), but that's a bit more of a hassle when you're just download a webpage. Hopefully Seyed and I can get the XML spec worked out this weekend, which would a) speed the use of the plugin up some, and b) give me very easy access to the data (instead of having to toss some regular expressions at an HTML page). Cross your fingers.
Usage Example
<MTBlogSharesUser id="1615">
My portfolio is worth $<MTBlogSharesTotalPortfolio>
</MTBlogSharesUser>
Update: (2003-04-20 00:25)
- Changes at BlogShares caused this plugin to break. I fixed it.
- I hope to be including support for some of the new features that Seyed has added recently.
Update: (2003-04-20 02:23)
- I added the following tags to the plugin by request :
- MTBlogSharesAvailable
- MTBlogSharesOutgoingLinkValue
- MTBlogSharesMarketShare
- Working on adding a share owners list to the plugin, but it is proving more difficult than I expected.
Update: (2003-04-22 15:37)
- I fixed the problem with the total portfolio tag. Seems Seyed went ahead and put some crazy things on the BlogShares pages, like commas in the dollar amounts. :)
Update: (2003-04-25 02:56)
- Finally added shares owners to the plugin. To access them use the following tags:
- MTBlogSharesOwners: container tag for the share owners
- MTBlogSharesOwner: the share owner's name
- MTBlogSharesOwned: the number of shares owned
Usage Example:
<MTBlogShares>
<MTBlogSharesOwners>
<MTBlogSharesOwner> owns <MTBlogSharesOwned> shares<br />
</MTBlogSharesOwners>
</MTBlogShares>
Update: (2003-05-01 13:04)
- The changes to the site broke the plugin again. I am working to fix the problem.
Big Update: (2003-05-01 13:18)
- The changes have been incorporated into the plugin. Everything should be working again. If not, please let me know. I'll look into adding some new features when I get home later tonight. But, for now, I need to get back to actual paying work. ;-)
Another Big Update: (2003-05-01 23:52)
- To celebrate the site going out of beta, I've implemented the following general tags for MTBlogShares:
- MTBlogSharesTotalBonds
- MTBlogSharesTotalProjected
- MTBlogSharesTotalReal
- And I've added a new container tag: MTBlogSharesUserRSS. it acts much like MTBlogSharesUser, except that it uses the portfolio RSS feed instead of the user page. If you do not have the XML::RSS perl module available, it and the following tags will not be available.
- MTBlogSharesUserStocks, which is a container tag for the other tags
- MTBlogSharesUserStockName
- MTBlogSharesUserStockNumber
- MTBlogSharesUserStockLink
- The plugin does not currently extract all the information that it possibly could, so if you have a specific request, please let me know and I'll incorporate it into a future version.
Update: (2003-05-06 16:11)
- I added another tag: MTBlogSharesUserStockSiteLink. It's just like MTBlogSharesUserStockLink, except that it returns a link to the actual site (which has been requested / hacked in a number of places already today). Enjoy! :)
Update: (2003-05-09 21:50)
- Updated to account for changes at the site. MTBlogSharesAvailable and MTBlogSharesTotalBonds should work now.
Update: (2003-05-15 10:39)
- For anyone who downloaded the plugin over the last few days, you may want to download it again. Thanks to me being a tad absent-minded lately, you either got a slightly older version if you downloaded it a couple days ago, or you got a broken version if you downloaded it yesterday. The version available now is working and has been verified by myself. I sincerely apologize for any problems I may have caused.
- In other news, the reason that recent copy was broken was because of a new feature I am implementing: MTBlogSharesOwnerSiteLink. For anyone that owns stock in your site, it will return the URL of their home page, if they have one listed in their Blogshares account.
Update: (2003-06-04 00:10)
- Seyed changed the site again. Amazingly enough, the URLs it uses haven't changed.
- MTBlogSharesTotalReal and MTBlogSharesTotalProjected are now considered deprecated. MTBlogSharesWorth replaces them.
- ( drum roll, please ) I have added three important new tags:
- MTBlogSharesOwnerIfSite: if the stock owner has a site
- MTBlogSharesOwnerSiteName: name of the stock owner's site
- MTBlogSharesOwnerSiteLink: url of the stock owner's site
- These three new tags make use of MT::PluginData to cache home page data, so that is now considered a requirement for the plugin.
Update: (2003-06-06 13:54)
- Fixed a bug that occured when the blog's outgoing link value was less than $100. Thanks to Ryan for letting me know.
template_tags=MTBlogShares,MTBlogSharesPrice,MTBlogSharesPE,MTBlogSharesUser,MTBlogSharesTotalPortfolio,MTBlogSharesAvailable,MTBlogSharesOutgoingLinkValue,MTBlogSharesMarketShare,MTBlogSharesOwners,MTBlogSharesOwner,MTBlogSharesOwned,MTBlogSharesTotalBonds,MTBlogSharesTotalProjected,MTBlogSharesTotalReal,MTBlogSharesUserRSS,MTBlogSharesUserStocks,MTBlogSharesUserStockName,MTBlogSharesUserStockNumber,MTBlogSharesUserStockLink,MTBlogSharesUserStockSiteLink,MTBlogSharesWorth,MTBlogSharesOwnerIfSite,MTBlogSharesOwnerSiteName,MTBlogSharesOwnerSiteLink
my hero :)
Awesome! Thanks! :)
sweet! thanks.
Excellent!! Great plugin!! Thanks!
You da man!
No sooner do I wish for such a plugin, but it appears! Thanks!
GREAT WORK!!!
I am VERY VERY impressed. I love it.
BlogShares ROCK!!! I think it is a great idea. I found your post on the MovableType PlugIn forum, and thus your page and the BlogShares page.
Thanks for all this. Your work is really appreciated, and earnt your blog a perm link on my pathetic little blog. :)
One tip. While I expect most users will understand how to use your tags, it might be nice to post an example of how to use your plugin in their template. :)
Keep up the great work.
Hrm — it doesn't like me. Bleah. I keep getting an "HTTP request error" during rebuilds. My code looks like this:
<MTBlogShares>
<blog_url="http://www.djwudi.com/longletter/">
Current value: <MTBlogSharesPrice><br/>
Current P/E: <MTBlogSharesPE>
</MTBlogShares>
Am I goofing something up?
Michael: No I'm getting the same error on rebuilds. Pull the plug-in code in order to get the site to rebuild properly.
The Blogshares site is hosed. Looks like the traffic has made the database barf. A flaw they are aware of (hey, it's a beta).
David: Can you add something to the next plug-in update so it won't error out when it can't connect to the Blogshares site? Sadly, I'm not familiar enough with MT to hack plugins.
I have a question for you about the plugin: when is the cost for the share determined? When the blog is rebuilt? When the page is accessed? I noticed my stock price hadn't changed since I'd rebuilt the site.
Can you do something like this for b2? it's mainly php-tag based instead of this MTblahblah stuff.
Okay, I am confused. It worked after the first rebuild, but now it won't work, even tho it's the same code!!!!
<MTBlogShares>
<blog_url="http://www.bozzysworld.com/">
current price: <MTBlogSharesPrice>
blogshares p/e: <MTBlogSharesPE>
</MTBlogShares>
WTF!!! How come the code didnt show!!! Everybody else got their code to show!!! Why did you stop allowing HTML!!! UGGG This code sucks. It won't show errors, and it won't show what it's supposed to show...it only shows NOTHING.
My code looks like this guys:
Posted by: Michael Hanscom on April 2, 2003 05:36 AM
How the hell did he post his code in here??!?!?!
Does anyone know if you get problems when trying to use this on multiple blogs in the same MT? I have three blogs that are listed, but on BiblioBlog (www.biblioblog.com), everything is coming up as 0. Anyone else have this problem?
Great Plugin!!!
Check It
I made a stand-alone PHP version of your script. So check it out @ http://www.geeklab.net/ellis/more.php?a=23
I had trouble when I tried using the blog_url but I took it out and everything works just fine now.
I've tried it both with and without the blog_url and it's not working for me.
You have to use the "blog_url" as an optional argument of the MTBlogShares container...
<MTBlogShares blog_url="http://yourblog.url">
Then the rest of the code...
Thank you - worked like a charm!!
Fil, that worked perfectly! Thanks!
I'm one of those people where I just can't get it to generate anything, either with or without the blog_url specified.
Cut & Dried:
<MTBlogShares blog_url="http://www.reallans.com/mmml.shtml">
Price: <MTBlogSharesPrice><br />
P/E Ratio: <MTBlogSharesPE><br />
</MTBlogShares>
Any Ideas?
This is great. I love it (and blogshares).. I thought of a tag/information i would fun
Shareholders
it would list those users in blogshares (and links to their blogs?) that own shares of your blog. Could be fun way to add some value to owning your blog :). and fun to see who has bought shares in your blog.
Everyone using the plugin seems to have their blog's worth and sharevalue reset to "0" all day today. Any ideas on this and how to fix it?
http://www.tampatantrum.com/leftovers/003171.html