How to find the post_id of a post on a wordpress blog that uses pretty URLs?

Most themes that I’ve seen use the post ID as the ID of the wrapping div for a post on the home page, archives, single post, etc. For example:

<div id="post-1920" class="post [...]">post content and meta</div>

So you could parse that with a regex or using something like Simple HTML DOM.

But again, this is theme-dependent. It may not work 100% of the time.

Also, on the single post page, if there is a comment form, there should be a hidden input with the name “comment_post_ID” that contains the post ID.